@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --bg-canvas: #dce8f8;
    --bg-soft: #eef5ff;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --line: #dbe4ee;
    --text: #0f172a;
    --text-muted: #64748b;
    --success-bg: #dcfce7;
    --success-fg: #166534;
    --danger-bg: #ffe4e6;
    --danger-fg: #9f1239;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    color: var(--text);
    background: linear-gradient(135deg, #dce7f7 0%, #cddcf0 45%, #e9f5ff 100%);
    line-height: 1.45;
}

.app-shell {
    min-height: 100vh;
}

.app-frame {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    min-height: 100vh;
    gap: 1.25rem;
    padding: 1.25rem;
}

.app-frame > .flex-1 {
    overflow: hidden;
    border-radius: 1.6rem;
    background: rgba(255, 255, 255, 0.62);
    box-shadow: 0 24px 70px rgba(45, 78, 120, 0.18);
    backdrop-filter: blur(14px);
}

.auth-shell {
    background:
        radial-gradient(circle at 20% 10%, #bfdbfe 0%, transparent 35%),
        radial-gradient(circle at 80% 20%, #99f6e4 0%, transparent 35%),
        linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}

[x-cloak] {
    display: none !important;
}

.app-sidebar {
    flex: 0 0 17rem;
}

.sidebar-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
    border-radius: 1.6rem;
    border: 1px solid rgba(255, 255, 255, 0.72);
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 24px 70px rgba(45, 78, 120, 0.18);
    backdrop-filter: blur(18px);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1.15rem 1.2rem;
}

.brand-mark {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    border-radius: 1rem;
    color: #fff;
    font-weight: 800;
    background: linear-gradient(135deg, #1d4ed8, #7c3aed);
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.28);
}

.sidebar-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    margin: 0 1rem 1rem;
    padding: 1.15rem 1rem;
    border-radius: 1.35rem;
    background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.16), 0 14px 30px rgba(59, 86, 125, 0.08);
}

.profile-avatar {
    display: grid;
    width: 4rem;
    height: 4rem;
    place-items: center;
    border-radius: 999px;
    border: 5px solid #fff;
    color: #1d4ed8;
    font-size: 1.35rem;
    font-weight: 800;
    background: linear-gradient(135deg, #dbeafe, #eef2ff);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.18);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.35rem 0.85rem 1rem;
}

.sidebar-link,
.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #64748b;
    text-decoration: none;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-link {
    min-height: 2.75rem;
    padding: 0 0.85rem;
    border-radius: 1rem;
    font-size: 0.92rem;
    font-weight: 700;
}

.sidebar-link:hover,
.sidebar-sublink:hover {
    color: #1d4ed8;
    background: #eef4ff;
}

.sidebar-link.sidebar-active {
    color: #1d4ed8 !important;
    background: linear-gradient(135deg, #eef4ff, #ffffff) !important;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.12);
}

.sidebar-subnav {
    margin: 0.35rem 0 0.6rem 1.2rem;
    padding-left: 0.65rem;
    border-left: 1px solid #dbe5f3;
}

.sidebar-sublink {
    min-height: 2.2rem;
    padding: 0 0.75rem;
    border-radius: 0.8rem;
    font-size: 0.82rem;
    font-weight: 650;
}

.sidebar-sublink.sidebar-active {
    color: #1d4ed8 !important;
    background: #eef4ff !important;
}

.badge-pending {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-processing {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-completed {
    background-color: var(--success-bg);
    color: var(--success-fg);
}

.badge-cancelled {
    background-color: var(--danger-bg);
    color: var(--danger-fg);
}

main > div > .bg-white,
main > .bg-white {
    border: 1px solid var(--line);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.05);
}

main .bg-white {
    border-radius: 1.25rem !important;
}

button,
a[class*='bg-primary'] {
    border-radius: 0.75rem;
}

input[type='text'],
input[type='email'],
input[type='number'],
input[type='date'],
input[type='password'],
select,
textarea {
    border-color: #cbd5e1 !important;
    border-radius: 0.85rem !important;
    min-height: 42px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type='text']:focus,
input[type='email']:focus,
input[type='number']:focus,
input[type='date']:focus,
input[type='password']:focus,
select:focus,
textarea:focus {
    border-color: #0f172a !important;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.12) !important;
    outline: none;
}

.cart-item {
    transition: all 0.2s ease;
}

.cart-item:hover {
    background-color: #f1f5f9;
}

.product-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

@media (max-width: 1024px) {
    .app-frame {
        gap: 1rem;
        padding: 1rem;
    }
}

@media (min-width: 768px) {
    .mobile-bottom-nav {
        display: none !important;
    }

    #sidebar-primary {
        position: relative !important;
        inset: auto !important;
        transform: translateX(0) !important;
    }

    #sidebar-overlay {
        display: none !important;
    }
}

@media (max-width: 768px) {
    body {
        background: #eef5ff;
        padding-bottom: calc(5.4rem + env(safe-area-inset-bottom, 0px));
    }

    main {
        padding: 0.9rem 0.9rem 1.25rem !important;
    }

    .app-frame {
        display: block !important;
        min-height: 100dvh;
        padding: 0;
    }

    .app-frame > .flex-1 {
        min-height: 100dvh;
        border-radius: 0;
        background: rgba(255, 255, 255, 0.72);
        overflow: visible !important;
        backdrop-filter: none !important;
    }

    .app-sidebar {
        width: min(18rem, calc(100vw - 2rem));
        padding: 0.8rem;
    }

    .sidebar-card {
        border-radius: 1.35rem;
    }

    main .grid {
        gap: 0.9rem !important;
    }

    main > div {
        max-width: 100% !important;
    }

    main h1 {
        font-size: 1.35rem !important;
        line-height: 1.2 !important;
    }

    main h2,
    main h3 {
        line-height: 1.25 !important;
    }

    main .bg-white,
    main > div > .bg-white,
    main > .bg-white {
        border-radius: 1.05rem !important;
    }

    main .flex.items-center.justify-between,
    main .flex.justify-between {
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    main .flex.items-center.justify-between:not(.keep-row),
    main .flex.justify-between:not(.keep-row) {
        flex-wrap: wrap !important;
    }

    main form .grid,
    main .grid.grid-cols-1,
    main .grid.md\:grid-cols-2,
    main .grid.md\:grid-cols-3,
    main .grid.lg\:grid-cols-2,
    main .grid.lg\:grid-cols-3,
    main .grid.lg\:grid-cols-4 {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    main input,
    main select,
    main textarea,
    main button,
    main a[class*='bg-primary'] {
        max-width: 100%;
    }

    main table {
        min-width: 42rem;
    }

    main .overflow-x-auto,
    main .bg-white:has(table),
    main .border:has(table) {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    main th,
    main td {
        white-space: nowrap;
    }

    .desktop-footer {
        display: none;
    }
}

@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: #fff;
    }
}

.loading-spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #0f172a;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #e11d48;
    color: #fff;
    border-radius: 9999px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.mobile-bottom-nav {
    position: fixed !important;
    right: 0.85rem;
    bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
    left: 0.85rem;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.25rem;
    padding: 0.45rem;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 1.35rem;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 20px 48px rgba(45, 78, 120, 0.24);
    backdrop-filter: blur(18px);
}

.mobile-bottom-link {
    display: flex;
    min-width: 0;
    min-height: 3.25rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    border-radius: 1rem;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.mobile-bottom-icon,
.mobile-bottom-link svg {
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 auto;
    stroke-width: 2.35;
}

.mobile-bottom-link.is-active {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

.mobile-bottom-link:active {
    transform: scale(0.96);
}

@media (min-width: 768px) {
    .mobile-bottom-nav {
        display: none !important;
    }
}
