/* CSS Variables */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --mobile-breakpoint: 768px;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text);
    font-size: 16px;
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* Login Screen */
.login-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: white;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 2rem;
    margin: 0.5rem 0 0.25rem;
    color: var(--primary);
}

.login-header p {
    color: var(--text-secondary);
}

/* App Header */
.app-header {
    background: var(--surface);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.95);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.menu-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text);
    padding: 0.25rem;
    cursor: pointer;
}

.app-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.dairy-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--primary-light);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100%;
    background: white;
    z-index: 200;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    padding: 1rem;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav {
    margin-top: 1.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
}

.nav-item:hover,
.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item i {
    width: 1.25rem;
}

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 150;
}

.sidebar-overlay.active {
    display: block;
}

/* Main Content */
.main-content {
    padding: 1rem;
    padding-bottom: 80px;
    max-width: 1200px;
    margin: 0 auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.page-header h2 {
    font-size: 1.25rem;
}

.date-display {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-card .stat-icon {
    font-size: 1.5rem;
    opacity: 0.5;
}

.dashboard-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.dashboard-recent {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--border);
}

.dashboard-recent h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

.btn:active {
    transform: scale(0.98);
}

/* Form */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.error-message {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    text-align: center;
}

/* Customers List */
.customers-list {
    display: grid;
    gap: 0.75rem;
}

.customer-card {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.customer-info {
    flex: 1;
}

.customer-name {
    font-weight: 600;
}

.customer-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.customer-actions {
    display: flex;
    gap: 0.5rem;
}

/* Entries List */
.entries-list {
    display: grid;
    gap: 0.5rem;
}

.entry-item {
    background: var(--surface);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.entry-info {
    flex: 1;
}

.entry-customer {
    font-weight: 500;
}

.entry-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.entry-amount {
    font-weight: 600;
    color: var(--primary);
}

.shift-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.shift-morning {
    background: #fef3c7;
    color: #92400e;
}

.shift-evening {
    background: #dbeafe;
    color: #1e40af;
}

/* Bottom Navigation */
.bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 50;
    padding: 0.25rem 0;
    justify-content: space-around;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.25rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    transition: color 0.2s;
}

.bottom-nav-item i {
    font-size: 1.25rem;
}

.bottom-nav-item.active {
    color: var(--primary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.1rem;
}

#modalBody {
    padding: 1rem;
}

/* Filters */
.filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filters select,
.filters input {
    flex: 1;
    min-width: 120px;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
}

/* Price Cards */
.prices-container {
    display: grid;
    gap: 1rem;
}

.price-card {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.price-display {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0.5rem 0;
}

.price-display small {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.customer-price-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

/* Bill Form */
.bill-form {
    max-width: 500px;
}

.bill-preview {
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow-x: auto;
}

/* Responsive */
@media (min-width: 768px) {
    .dashboard-stats {
        grid-template-columns: repeat(4, 1fr);
    }

    .dashboard-actions {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .customers-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .bottom-nav {
        display: none;
    }

    .main-content {
        padding-bottom: 1rem;
    }

    .menu-btn {
        display: none;
    }

    .sidebar {
        position: static;
        width: auto;
        height: auto;
        box-shadow: none;
        padding: 0;
        margin-right: 1rem;
    }

    .sidebar-header {
        display: none;
    }

    .sidebar-nav {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
        margin-top: 0;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .app-header {
        padding: 0.5rem 2rem;
    }
}

@media (max-width: 767px) {
    .bottom-nav {
        display: flex;
    }

    .nav-item {
        padding: 0.5rem 0.75rem;
    }

    .stat-card .stat-value {
        font-size: 1.2rem;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-col { flex-direction: column; }
.w-full { width: 100%; }