* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 24px;
}

.user-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

.user-info span {
    font-weight: 500;
}

.login-box {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.login-box h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 10px;
}

.login-box h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 20px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 30px;
    background: #f8f9fa;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-card h3 {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
}

.main-content {
    padding: 20px;
    overflow-x: visible;
    width: 100%;
}

.add-order-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.add-order-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.order-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group textarea {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
    font-family: inherit;
    width: 100%;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group select {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
    background: white;
    width: 100%;
}

.form-group-full {
    grid-column: 1 / -1;
}

.orders-section {
    margin-top: 30px;
    width: 100%;
    overflow-x: visible;
}

.orders-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.filter-section {
    padding: 20px 30px;
    background: #f8f9fa;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-section > div {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
    text-align: center;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

.table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    margin: 20px -20px;
    padding: 0 20px;
    display: block;
    width: 100%;
    position: relative;
}

/* Show scrollbar for better UX */
.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

.orders-table {
    width: 100%;
    min-width: 1200px; /* Force horizontal scroll on smaller screens */
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: visible;
    table-layout: auto;
    white-space: nowrap;
}

.orders-table thead {
    background: #667eea;
    color: white;
}

.orders-table th {
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    white-space: nowrap;
}

.orders-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.orders-table tbody tr:hover {
    background: #f8f9fa;
}

.orders-table tbody tr.paid {
    background: #d4edda;
    opacity: 0.8;
}

.orders-table tbody tr.unpaid {
    background: #fff3cd;
}

.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: #28a745;
    color: white;
}

.badge-warning {
    background: #ffc107;
    color: #333;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 5px;
    margin: 20px 30px;
    border: 1px solid #c3e6cb;
}

.no-orders {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.info {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 12px;
    font-style: italic;
}

/* Mobile Card View for Orders */
/* Order cards - hidden on desktop, shown on mobile */
.order-card {
    display: none; /* Hidden by default (desktop) */
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Force hide cards on desktop screens - must be before mobile media query */
@media screen and (min-width: 769px) {
    .order-card {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

.order-card.paid {
    background: #d4edda;
    opacity: 0.9;
}

.order-card.unpaid {
    background: #fff3cd;
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.order-card-id {
    font-weight: bold;
    color: #667eea;
    font-size: 18px;
}

.order-card-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.order-card-label {
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

.order-card-value {
    color: #333;
    text-align: right;
    flex: 1;
    margin-left: 10px;
}

/* Prevent text size adjustment on iOS */
input[type="text"],
input[type="number"],
input[type="password"],
textarea,
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .container {
        border-radius: 0;
        margin: 0;
        box-shadow: none;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px;
    }
    
    .form-group textarea {
        min-height: 120px;
    }
    
    .stats {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-number {
        font-size: 28px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px 20px;
    }
    
    header h1 {
        font-size: 20px;
    }
    
    .user-info {
        flex-direction: column;
        width: 100%;
    }
    
    .user-info .btn {
        width: 100%;
        margin: 5px 0;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .add-order-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .orders-section {
        margin-top: 20px;
    }
    
    /* Hide table on mobile, show cards */
    .table-wrapper {
        display: none !important;
    }
    
    .order-card {
        display: block !important;
    }
    
    /* Make table scrollable on mobile if it shows */
    .orders-table {
        min-width: 600px;
        font-size: 11px;
    }
    
    .filter-section {
        padding: 15px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-section > div {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-section .btn {
        width: 100%;
        margin: 5px 0;
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 16px;
        width: 100%;
        margin: 5px 0;
    }
    
    .btn-small {
        padding: 10px 15px;
        font-size: 14px;
        min-height: 44px;
    }
    
    .success,
    .error {
        margin: 15px;
        padding: 15px;
        font-size: 15px;
    }
    
    .login-box {
        margin: 20px auto;
        padding: 30px 20px;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .stat-number {
        font-size: 24px;
    }
    
    .order-card {
        padding: 12px;
    }
    
    .order-card-row {
        flex-direction: column;
    }
    
    .order-card-value {
        text-align: left;
        margin-left: 0;
        margin-top: 5px;
    }
}

