@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;700&display=swap');

:root {
    --bg: #0F172A;
    --card: rgba(30, 41, 59, 0.7);
    --border: rgba(255, 255, 255, 0.1);
    --primary: #38BDF8;
    --text: #F8FAFC;
    --muted: #94A3B8;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    margin: 0;
    height: 100vh;
    /* Default Desktop */
    display: flex;
    /* Default Desktop */
    flex-direction: column;
    /* Default Desktop */
    overflow: hidden;
    /* Default Desktop */
}

/* WRAPPER */
.dashboard-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    /* Desktop: Inner scroll */
}

/* MOBILE APP UI (Native Feel) */
@media (max-width: 768px) {

    /* 1. LOCK SCREEN & LAYOUT */
    body {
        height: 100vh !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        background: var(--bg);
    }

    .dashboard-wrapper {
        flex: 1;
        overflow: hidden;
        /* Content scrolls inside */
        flex-direction: column;
    }

    /* 2. HIDE DESKTOP SIDEBAR */
    .sidebar {
        display: none !important;
    }

    /* 3. FULL WIDTH CONTENT */
    .main-content {
        width: 100% !important;
        padding: 1rem !important;
        padding-bottom: 90px !important;
        /* Space for Bottom Bar */
        overflow-y: auto !important;
        /* Internal Scroll */
        -webkit-overflow-scrolling: touch;
        /* Smooth iOS Scroll */
        background: var(--bg);
    }

    /* 4. BOTTOM NAVIGATION BAR */
    .mobile-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: rgba(15, 23, 42, 0.98);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        justify-content: space-around;
        align-items: center;
        padding: 10px 0;
        padding-bottom: env(safe-area-inset-bottom, 10px);
        /* iPhone Home Bar Safe Area */
        z-index: 9999;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: #64748B;
        /* Slate 500 */
        background: none;
        border: none;
        font-size: 10px;
        gap: 4px;
        cursor: pointer;
        font-family: 'Outfit', sans-serif;
        flex: 1;
    }

    .mobile-nav-item.active {
        color: #38BDF8;
        /* Primary Blue */
    }

    .mobile-nav-item .material-icons {
        font-size: 24px;
        margin-bottom: 2px;
    }

    /* 5. COMPONENTS TWEAKS */
    .card.wide {
        width: 100%;
        overflow-x: scroll;
        box-sizing: border-box;
    }

    h1 {
        font-size: 1.5rem;
    }

    /* 6. PAGE SPECIFIC ADAPTATIONS */

    /* SUPPORT (Chat) - Full Screen Native Feel */
    #view-support {
        display: flex;
        flex-direction: column;
        height: 100%;
        /* Fill container */
    }

    #view-support header {
        display: none;
        /* Save space, redundant title */
    }

    #view-support .card {
        height: auto !important;
        flex: 1;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        border-radius: 0;
    }

    .chat-window {
        padding-bottom: 180px !important;
        /* Space for input */
    }

    .chat-input-area {
        position: fixed;
        bottom: 90px;
        bottom: calc(90px + env(safe-area-inset-bottom));
        left: 0;
        width: 100%;
        background: #1e293b !important;
        border-top: 1px solid var(--primary);
        padding: 10px !important;
        z-index: 99999;
        box-sizing: border-box;
        display: flex;
        gap: 5px;
    }

    /* TABLES (Invoices/Quotes) */
    .data-table {
        font-size: 0.8rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.8rem 0.5rem !important;
    }

    .status-pill {
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
    }

    /* FILES GRID */
    .file-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        /* 2 columns on mobile */
        gap: 10px !important;
    }

    .file-item {
        min-height: 120px !important;
        padding: 1rem !important;
    }

    .file-name {
        font-size: 0.8rem !important;
    }
}

/* Default state for Mobile Nav (Hidden on Desktop) */
.mobile-nav {
    display: none;
}

/* SIDEBAR & NAV */
.dashboard-page {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.95);
    border-right: 1px solid var(--border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 1rem;
    background: none;
    border: none;
    color: var(--muted);
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: 0.2s;
}

.nav-btn:hover,
.nav-btn.active {
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary);
}

.nav-btn.active {
    font-weight: bold;
    border-left: 3px solid var(--primary);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
}

/* CARDS & GRID */
.grid-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.card {
    padding: 2rem;
    border-radius: 12px;
    height: fit-content;
}

.glass-effect {
    background: var(--card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* TABLES (FILES & INVOICES) */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table th {
    text-align: left;
    padding: 1rem;
    border-bottom: 2px solid var(--border);
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.tag {
    padding: 0.3rem 0.6rem;
    background: #334155;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.tag-img {
    background: #475569;
    color: #E2E8F0;
}

.status-pill {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}

.status-pill.done {
    background: rgba(34, 197, 94, 0.2);
    color: #86EFAC;
}

.status-pill.pending {
    background: rgba(234, 179, 8, 0.2);
    color: #FDE047;
}

.pulsate {
    animation: pulse 2s infinite;
}

/* CHAT (SUPPORT) */
.msg {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

.msg.bot {
    align-items: flex-start;
}

.msg.user {
    align-items: flex-end;
}

.msg-bubble {
    padding: 1rem;
    border-radius: 12px;
    max-width: 70%;
    line-height: 1.5;
}

.msg.bot .msg-bubble {
    background: #334155;
    color: white;
    border-bottom-left-radius: 2px;
}

.msg.user .msg-bubble {
    background: var(--primary);
    color: #0F172A;
    border-bottom-right-radius: 2px;
}

.msg-meta {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.3rem;
}

/* BUTTONS */
.btn-primary {
    background: var(--primary);
    color: #0F172A;
    font-weight: bold;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
}

.btn-sm {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-sm:hover {
    background: var(--primary);
    color: #0f172a;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-weight: bold;
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
}

/* UTILS */
.logo-text {
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.highlight {
    color: var(--primary);
}

.btn-logout {
    margin-top: auto;
    background: none;
    border: 1px solid var(--border);
    color: #FCA5A5;
    padding: 0.8rem;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.progress-track {
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 1s ease;
    box-shadow: 0 0 10px var(--primary);
}

.steps-container {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
}

.step {
    text-align: center;
    opacity: 0.5;
    position: relative;
    width: 100%;
}

.step::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border);
    z-index: -1;
}

.step:last-child::after {
    display: none;
}

.step.active,
.step.done {
    opacity: 1;
}

.step-icon {
    width: 30px;
    height: 30px;
    border: 2px solid var(--muted);
    border-radius: 50%;
    margin: 0 auto 0.5rem auto;
    background: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}

.step.done .step-icon,
.step.active .step-icon {
    border-color: var(--primary);
    color: var(--primary);
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* AUTH PAGE Specifics needed if style.css is shared */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: radial-gradient(circle at top, #1e293b, #0f172a);
}

.auth-container {
    width: 400px;
    padding: 2.5rem;
    border-radius: 16px;
}

/* MOBILE RESPONSIVE - AUTH PAGE */
@media (max-width: 768px) {
    .auth-container {
        width: 90% !important;
        max-width: 100%;
        padding: 1.5rem !important;
        margin: 1rem;
        box-sizing: border-box;
    }

    .auth-page {
        padding: 1rem;
    }

    .logo-text {
        font-size: 1.3rem !important;
    }

    .input-group input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.9rem !important;
    }

    .btn-primary.full-width {
        padding: 1rem !important;
        font-size: 1rem;
    }
}

.input-group {
    margin-bottom: 1.2rem;
    text-align: left;
}

.input-group input {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    outline: none;
}

.tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--muted);
    padding: 0.8rem;
    cursor: pointer;
}

.tab.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    font-weight: bold;
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}