:root {
    --primary: #4338ca; /* Deep Indigo */
    --primary-hover: #3730a3;
    --primary-light: #e0e7ff;
    --bg-color: #f8fafc;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
    --success: #059669;
    --danger: #dc2626;
    --radius: 16px;
    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 8px 24px -4px rgba(67, 56, 202, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* App Header */
.app-header {
    background: var(--primary);
    color: var(--text-main);
    padding: 20px 24px;
    padding-top: max(20px, env(safe-area-inset-top));
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.2);
    z-index: 10;
}

.app-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
}

/* Screens */
.screen {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* Login Screen */
#login-screen {
    justify-content: center;
    padding: 32px;
}

.login-card {
    background: var(--surface);
    padding: 36px 24px;
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
}

.login-card h2 {
    color: var(--text-main);
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 0.95rem;
}

.input-group {
    margin-bottom: 24px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.input-group input, .login-input {
    width: 100%;
    padding: 16px 18px;
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    color: var(--text-main);
}

.input-group input:focus, .login-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: var(--text-main);
    border: none;
    padding: 16px;
    width: 100%;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}

.btn-primary:active {
    transform: scale(0.96);
    box-shadow: 0 4px 12px -4px rgba(67, 56, 202, 0.3);
}

/* Dashboard / Customer List */
.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-main);
}

.customer-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.customer-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    border: 1px solid rgba(226, 232, 240, 0.6);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}

.customer-card:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.customer-avatar {
    width: 48px;
    height: 48px;
    border-radius: 24px;
    background: #eff6ff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    margin-right: 16px;
}

.customer-info flex-grow {
    flex: 1;
}

.customer-name {
    font-weight: 700;
    font-size: 1.05rem;
}

.customer-details {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* Catalog Screen */
#catalog-header {
    background: var(--surface);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.catalog-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.product-card {
    background: #ffffff;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(226, 232, 240, 0.6);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 5px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.product-card:active {
    transform: scale(0.97);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.product-id-badge {
    display: inline-block;
    background: var(--bg-color);
    color: #475569;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.product-name {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 4px;
    line-height: 1.2;
}

.product-category {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.stock-badge {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.product-sizes {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed #e2e8f0;
}

.size-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.size-tag {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: #334155;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    background: var(--bg-color);
    border-radius: 8px;
    padding: 4px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--surface);
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    color: var(--primary);
}

.qty-display {
    font-weight: 700;
}

/* Checkout Bar */
.checkout-bar {
    position: fixed;
    bottom: 70px; /* sit above bottom nav */
    left: 0;
    width: 100%;
    background: var(--surface);
    padding: 16px 24px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 20;
    transform: translateY(calc(100% + 70px));
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkout-bar.visible {
    transform: translateY(0);
}

.checkout-total {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
}

.btn-checkout {
    background: var(--success);
    color: var(--text-main);
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Loader */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.loader-overlay.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}/* Custom Dialog Overlay */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 10005;
    padding: 24px;
}
.dialog-overlay.active {
    display: flex;
}
.dialog-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
    transform: scale(0.95);
    transition: transform 0.2s ease-out;
}
.dialog-overlay.active .dialog-card {
    transform: scale(1);
}
.dialog-card h3 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 1.2rem;
}
.dialog-card p {
    color: var(--text-main);
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.5;
}
.dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.dialog-actions button {
    flex: 1;
}
.btn-secondary {
    background: var(--primary);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
}


/* Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 76px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(226, 232, 240, 0.6);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 1000;
    box-shadow: 0 -10px 20px -5px rgba(0, 0, 0, 0.03);
    display: none;
}

.bottom-nav.visible {
    display: flex;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex: 1;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 10px 0;
    border-radius: 16px;
    margin: 0 8px;
    position: relative;
}

.nav-item ion-icon {
    font-size: 1.6rem;
    margin-bottom: 4px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 700;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 64px; height: 64px;
    background: var(--primary-light);
    border-radius: 20px;
    z-index: -1;
    opacity: 0.5;
}

.nav-item.active ion-icon {
    transform: translateY(-2px) scale(1.15);
}

.nav-item.active span {
    opacity: 1;
}

.nav-fab-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.nav-fab-container span {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
    position: absolute;
    bottom: -10px;
}

.nav-fab {
    width: 62px;
    height: 62px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    font-size: 2.2rem;
    box-shadow: 0 10px 24px -6px rgba(67, 56, 202, 0.6);
    transform: translateY(-24px);
    border: 5px solid var(--surface);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}

.nav-fab:active {
    transform: translateY(-20px) scale(0.95);
    box-shadow: 0 4px 12px -4px rgba(67, 56, 202, 0.5);
}

/* Dropdown Styles */
select.login-input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234338ca' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 48px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    background-color: #f8fafc;
    border-radius: 10px; /* Sharper edges */
    font-weight: 600; /* Bolder text for sharper look */
}
select.login-input:focus {
    box-shadow: 0 0 0 3px var(--primary-light);
    border-color: var(--primary);
    background-color: #ffffff;
}

/* Adjust screens to not hide behind bottom nav */
.screen {
    padding-bottom: 90px;
}

/* Custom Dropdown Trigger */
.custom-select-trigger {
    width: 100%;
    padding: 16px 18px;
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    font-size: 1rem;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.custom-select-trigger:active {
    background: var(--bg-color);
    transform: scale(0.98);
}

/* Bottom Sheet Modal */
.bottom-sheet-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    animation: fadeIn 0.2s forwards;
}
@keyframes fadeIn { to { opacity: 1; } }

.bottom-sheet-content {
    width: 100%;
    background: var(--surface);
    border-radius: 24px 24px 0 0;
    padding: 24px 20px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    animation: slideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes slideUp { to { transform: translateY(0); } }

.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.bottom-sheet-header h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
}

.bottom-sheet-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 30px;
}

/* Rich Item Cards */
.rich-dropdown-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 16px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}
.rich-dropdown-item:active {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: scale(0.98);
}
.rich-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    font-size: 1.2rem;
    margin-right: 16px;
}
.rich-item-info {
    flex: 1;
}
.rich-item-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-main);
    margin-bottom: 4px;
}
.rich-item-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.rich-item-price {
    font-weight: 800;
    color: var(--success);
    background: rgba(5, 150, 105, 0.1);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.95rem;
}
#pull-to-refresh {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translate(-50%, -150%);
    width: 44px;
    height: 44px;
    background: var(--surface);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 45;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0;
    pointer-events: none;
}
#pull-to-refresh.pulling {
    opacity: 1;
    transition: none;
}
#pull-to-refresh.refreshing {
    transform: translate(-50%, 20px) !important;
    opacity: 1;
}
#pull-to-refresh.refreshing ion-icon {
    animation: spin 1s linear infinite;
    color: var(--primary) !important;
}

/* Professional Date Filter Styles */
.pro-date-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background: var(--surface);
    border-radius: 16px;
    padding: 8px 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid var(--border-color);
    gap: 8px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.pro-date-filter:focus-within {
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.1);
}

.filter-group {
    flex: 1;
    min-width: 130px;
}

.filter-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border-radius: 12px;
    background: var(--bg-color);
    transition: background 0.2s ease;
    position: relative;
}

.filter-input-wrapper:focus-within {
    background: var(--bg-color);
}

.input-icon {
    font-size: 1.2rem;
    color: var(--primary);
    opacity: 0.8;
}

.input-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.input-content label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.pro-input {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    outline: none;
    width: 100%;
    padding: 0;
    cursor: pointer;
}

.pro-input::-webkit-calendar-picker-indicator {
    opacity: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.filter-divider {
    color: #cbd5e1;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
}

.pro-clear-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: none;
    border-radius: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 4px;
}

.pro-clear-btn:hover {
    background: #fee2e2;
    transform: scale(1.05);
}

.pro-clear-btn:active {
    transform: scale(0.95);
}
