/* -----------------------------
   GLOBAL RESET / BASE
------------------------------ */

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    transition: background-color 0.25s ease, color 0.25s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
}

img {
    max-width: 100%;
}

/* =====================================================
   AUTH LAYOUT
===================================================== */

.auth-page {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 40px 16px 24px;
}

.auth-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
}

.auth-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
}

.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    z-index: 1;
}

.auth-brand {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #111827;
    text-shadow: 0 1px 0 rgba(255,255,255,0.65);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    background-color: #ffffff !important;
    color: #111827;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
    animation: fadeUp 0.45s ease-out;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card .form-control {
    background-color: #ffffff;
    color: #111827;
    border: 1px solid #d1d5db;
}

    .auth-card .form-control::placeholder {
        color: #9ca3af;
    }

    .auth-card .form-control:focus {
        border-color: #2563eb;
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    }

.auth-card .btn-primary {
    background-color: #2563eb;
    border-color: #2563eb;
    font-weight: 600;
    padding: 10px 16px;
}

    .auth-card .btn-primary:hover {
        background-color: #1d4ed8;
        border-color: #1d4ed8;
    }

.auth-card h2 {
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.auth-card .form-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 24px;
}

.auth-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.auth-submit {
    margin-top: 8px;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 700;
}

/* Animated background */
.bg-animated {
    position: absolute;
    inset: -30%;
    background: linear-gradient(120deg, #dbeafe, #e0f2fe, #ede9fe);
    background-size: 200% 200%;
    animation: gradientMove 30s ease infinite;
    filter: blur(80px);
    opacity: 1;
    z-index: 0;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@media (max-width: 640px) {
    .auth-brand {
        font-size: 24px;
    }
}

/* =====================================================
   GENERIC SURFACES
===================================================== */

.card,
.card-app,
.page-content {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    padding: 1rem 1.25rem;
}

.page-content {
    padding: 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    margin: 0;
}

/* =====================================================
   TEXT / UTILITIES
===================================================== */

.text-secondary {
    color: var(--text-muted) !important;
}

.section-label {
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-soft);
    margin-bottom: 10px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    display: inline-block;
    flex-shrink: 0;
}

.status-dot-success {
    background-color: var(--success);
}

.attention-dot {
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    display: inline-block;
}

/* =====================================================
   FORMS
===================================================== */

.form-control,
.form-select {
    background-color: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.625rem 0.875rem;
    min-height: 44px;
}

    .form-control::placeholder {
        color: var(--text-soft);
    }

    .form-control:focus,
    .form-select:focus {
        background-color: var(--input-bg);
        color: var(--text);
        border-color: var(--primary);
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    }

.input-group-text {
    background-color: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text-soft);
}

/* =====================================================
   BUTTONS
===================================================== */

.btn {
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.18s ease;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18);
}

    .btn-primary:hover,
    .btn-primary:focus {
        background-color: var(--primary-hover);
        border-color: var(--primary-hover);
        transform: translateY(-1px);
    }

.btn-outline-secondary {
    color: var(--text);
    border-color: var(--border-strong);
    background-color: transparent;
}

    .btn-outline-secondary:hover,
    .btn-outline-secondary:focus {
        background-color: var(--card-muted);
        color: var(--text);
        border-color: var(--primary);
    }

.btn-surface {
    background-color: var(--card-muted);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 12px;
    padding: 0.7rem 0.9rem;
    box-shadow: none;
}

    .btn-surface:hover,
    .btn-surface:focus {
        background-color: var(--card-hover);
        border-color: var(--border-strong);
        color: var(--text);
    }

.btn-app-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background-color: var(--card);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

    .btn-app-icon:hover,
    .btn-app-icon:focus {
        background-color: var(--card-muted);
        border-color: var(--border-strong);
        color: var(--text);
    }

.app-logout-btn {
    border-radius: 12px;
    font-weight: 600;
}

/* =====================================================
   NAVBAR
===================================================== */

.app-navbar {
    height: 64px;
    background-color: rgba(255,255,255,0.8);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

:root[data-theme="dark"] .app-navbar {
    background-color: rgba(2, 6, 23, 0.82);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text) !important;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.app-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    color: white;
    font-size: 16px;
    font-weight: 800;
    box-shadow: 0 10px 20px rgba(37,99,235,0.18);
}

.app-brand-text {
    font-size: 1.05rem;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 12px 6px 6px;
    box-shadow: var(--shadow-xs);
}

.user-pill-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
}

.user-pill-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}

.user-pill-role {
    font-size: 11px;
    color: var(--text-soft);
    line-height: 1.1;
    margin-top: 2px;
}

.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background-color: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* =====================================================
   APP SHELL
===================================================== */

.app-shell {
    display: flex;
    min-height: calc(100vh - 64px);
}

.sidebar {
    width: 280px;
    min-width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    z-index: 1040;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 18px 14px 24px;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.sidebar-panel {
    background-color: transparent;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-soft);
    margin: 0 12px 8px;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    margin: 2px 0;
    border-radius: 14px;
    color: var(--sidebar-link);
    font-weight: 600;
    white-space: nowrap;
    position: relative;
}

    .sidebar .nav-link:hover {
        background-color: var(--sidebar-hover);
        color: var(--sidebar-link-hover);
    }

    .sidebar .nav-link.active {
        background-color: var(--sidebar-active);
        color: var(--sidebar-link-active);
        box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
    }

        .sidebar .nav-link.active::before {
            content: "";
            position: absolute;
            left: -6px;
            top: 9px;
            bottom: 9px;
            width: 4px;
            border-radius: 999px;
            background: var(--primary);
        }

.nav-icon {
    width: 20px;
    font-size: 17px;
    text-align: center;
    color: var(--icon-muted);
    flex-shrink: 0;
}

.sidebar .nav-link:hover .nav-icon,
.sidebar .nav-link.active .nav-icon {
    color: var(--primary);
}

.nav-text {
    flex: 1;
    min-width: 0;
}

.sidebar-backdrop {
    display: none;
}

/* =====================================================
   SIDEBAR COMPONENTS
===================================================== */

.location-card,
.setup-card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-xs);
}

.location-card {
    overflow: hidden;
}

.location-card-image-wrap {
    height: 130px;
    overflow: hidden;
    background-color: var(--card-muted);
}

.location-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.location-card-body {
    padding: 14px;
}

.location-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 4px;
}

.location-card-subtitle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-soft);
}

.setup-card {
    display: flex;
    gap: 12px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.03));
    border-color: rgba(245, 158, 11, 0.25);
}

.setup-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background-color: rgba(245, 158, 11, 0.14);
    color: #b45309;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.setup-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}

.setup-card-text {
    font-size: 12px;
    color: var(--text-soft);
    line-height: 1.45;
}

.app-dropdown {
    border-radius: 14px;
    padding: 8px;
    background-color: var(--card);
    border: 1px solid var(--border) !important;
}

    .app-dropdown .dropdown-item {
        border-radius: 10px;
        padding: 10px 12px;
        font-weight: 500;
        color: var(--text);
    }

        .app-dropdown .dropdown-item:hover,
        .app-dropdown .dropdown-item:focus {
            background-color: var(--card-muted);
        }

/* =====================================================
   CONTENT AREA
===================================================== */

.content-area {
    flex: 1;
    background-color: var(--bg);
    min-width: 0;
}

.content-wrap {
    padding: 24px;
}

/* =====================================================
   TABLES
===================================================== */

.table {
    color: var(--text);
    vertical-align: middle;
}

    .table th {
        color: var(--text-soft);
        font-weight: 700;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .table td,
    .table th {
        border-color: var(--border);
    }

/* =====================================================
   ALERTS
===================================================== */

.alert {
    background-color: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 14px;
}

/* =====================================================
   PAYMENT STATE
===================================================== */

.payment-state {
    display: flex;
    gap: 16px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

    .payment-state .state-icon {
        font-size: 22px;
        line-height: 1;
        margin-top: 2px;
    }

    .payment-state .state-content {
        flex: 1;
    }

    .payment-state.warning {
        background-color: rgba(245, 158, 11, 0.08);
        border-color: rgba(245, 158, 11, 0.3);
    }

    .payment-state.success {
        background-color: rgba(34, 197, 94, 0.08);
        border-color: rgba(34, 197, 94, 0.3);
    }

.state-detail {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
}

/* =====================================================
   PAY PAGE
===================================================== */

.pay-container {
    max-width: 420px;
    margin: 40px auto;
    padding: 20px;
    font-family: 'Inter', sans-serif;
}

.order-box {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 20px;
    background-color: var(--card);
}

.order-lines {
    list-style: none;
    padding: 0;
    margin: 0;
}

    .order-lines li {
        display: flex;
        justify-content: space-between;
        margin-bottom: 8px;
    }

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 700;
}

.pay-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
}

    .pay-btn:hover {
        background: var(--primary-hover);
    }

.secure-note {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-soft);
    text-align: center;
}

/* =====================================================
   INBOX
===================================================== */

.inbox-row {
    transition: background-color 0.18s ease;
}

    .inbox-row:hover {
        background-color: var(--card-muted);
    }

/* =====================================================
   MOBILE
===================================================== */

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 64px;
        height: calc(100vh - 64px);
        transition: left 0.25s ease;
        box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
    }

        .sidebar.open {
            left: 0;
        }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 64px 0 0 0;
        background: rgba(15, 23, 42, 0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 1035;
    }

        .sidebar-backdrop.show {
            opacity: 1;
            pointer-events: auto;
        }

    body.sidebar-open {
        overflow: hidden;
    }

    .content-wrap {
        padding: 18px;
    }

    .page-content {
        padding: 18px;
        border-radius: 16px;
    }
}

@media (max-width: 767.98px) {
    .app-navbar {
        height: 60px;
    }

    .app-shell {
        min-height: calc(100vh - 60px);
    }

    .sidebar {
        top: 60px;
        height: calc(100vh - 60px);
    }

    .sidebar-backdrop {
        inset: 60px 0 0 0;
    }

    .content-wrap {
        padding: 14px;
    }

    .page-title {
        font-size: 20px;
    }

    .user-pill {
        padding-right: 8px;
    }
}
