/* ========================================
   ORBIT DASHBOARD STYLES (PREMIUM EDITION)
   ======================================== */

/* --- TYPOGRAPHY --- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --glass-bg: linear-gradient(135deg, rgba(20, 30, 60, 0.4) 0%, rgba(20, 30, 60, 0.1) 100%);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --neon-accent: #00f3ff;
}

/* --- Custom Scrollbar (Premium Neon) --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(51, 65, 85, 0.5);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neon-accent);
    box-shadow: 0 0 10px var(--neon-accent);
}

/* --- Input Focus Glow --- */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--neon-accent) !important;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3), inset 0 0 10px rgba(0, 243, 255, 0.1) !important;
    transition: all 0.3s ease;
}

/* --- Table Row Hover Effect --- */
.orbit-table-modern tr {
    transition: all 0.2s ease;
}

.orbit-table-modern tbody tr:hover {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.03) 100%) !important;
    transform: scale(1.002);
    box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
    position: relative;
    border-left: 2px solid var(--neon-accent);
}

/* --- Background Aurora Animation (Subtle) --- */
@keyframes aurora {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

body {
    background: radial-gradient(circle at top right, #0f172a, #020617);
    /* Subtle overlay pattern */
    background-image:
        radial-gradient(circle at 15% 50%, rgba(76, 29, 149, 0.1), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.05), transparent 25%);
    background-attachment: fixed;
}

/* === NOTES SECTION === */
.notes-section {
    background: var(--fusion-surface);
    border: 1px solid var(--fusion-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--brand-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header button {
    padding: 8px 16px;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.section-header button:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

#notes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.note-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s;
}

.note-card:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.note-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--brand-secondary);
    flex: 1;
}

.note-actions {
    display: flex;
    gap: 4px;
}

.icon-btn {
    padding: 6px;
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: #e2e8f0;
    color: var(--brand-primary);
}

.note-content {
    font-size: 14px;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 8px;
}

.note-timestamp {
    font-size: 12px;
    color: #94a3b8;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
}

/* === RECEIVABLES SECTION === */
.receivables-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
}

.receivables-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 16px;
}

.receivables-table thead {
    background: rgba(255, 255, 255, 0.03);
}

.receivables-table th {
    padding: 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.receivables-table td {
    padding: 16px;
    font-size: 14px;
    color: #cbd5e1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.receivables-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* === NOTES SECTION (ADAPTIVE) === */
.notes-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
}

.notes-section h3 {
    color: #e2e8f0;
}

.note-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: white;
}

.note-card:hover {
    border-color: rgba(0, 243, 255, 0.3);
}

.note-content {
    color: rgba(255, 255, 255, 0.8);
}

.empty-state {
    color: rgba(255, 255, 255, 0.3);
}

/* === COMPACT AI ASSISTANT === */
.ai-assistant-compact {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.ai-toggle {
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--brand-primary), #1d4ed8);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.ai-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.ai-toggle i {
    font-size: 18px;
}

.ai-panel {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 320px;
    background: #1e293b;
    /* Fixed dark bg */
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.ai-panel.hidden {
    display: none;
}

.ai-panel textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    color: white;
    resize: vertical;
    margin-bottom: 12px;
}

.ai-panel textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
}

.ai-panel button {
    width: 100%;
    padding: 10px;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-panel button:hover {
    background: #1d4ed8;
}

/* === DASHBOARD QUICK ACTIONS (REDESIGNED) === */
.dashboard-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 24px;
}

.quick-action-card {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.quick-action-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.quick-action-card:hover {
    transform: translateY(-5px);
    border-color: #00f3ff;
    box-shadow: 0 10px 30px -10px rgba(0, 243, 255, 0.2);
    background: rgba(0, 243, 255, 0.05);
}

.quick-action-card:hover::before {
    opacity: 1;
}

.quick-action-card i {
    font-size: 32px;
    color: #00f3ff;
    margin-bottom: 12px;
    transition: transform 0.3s;
}

.quick-action-card:hover i {
    transform: scale(1.1);
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.8);
}

.quick-action-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    letter-spacing: 0.5px;
}

.quick-action-card p {
    font-size: 11px;
    color: #cbd5e1;
    margin-top: 6px;
    max-width: 90%;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .dashboard-quick-actions {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on mobile */
        gap: 10px;
    }

    .quick-action-card {
        padding: 15px;
    }

    .quick-action-card i {
        font-size: 24px;
    }

    .quick-action-card p {
        display: none;
        /* Hide desc on mobile for compactness */
    }

    .receivables-table {
        font-size: 12px;
    }

    .receivables-table th,
    .receivables-table td {
        padding: 8px 6px;
    }

    .ai-panel {
        width: 280px;
    }
}

/* ========================================
   ORBIT MODERN UI KIT (ADDED PHASE 9)
   ======================================== */

/* --- Animations --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
        filter: blur(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* --- Glass Cards (Standardized) --- */
.orbit-card-glass {
    background: var(--glass-bg, rgba(255, 255, 255, 0.03));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border, 1px solid rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    box-shadow: var(--glass-shadow, 0 8px 32px rgba(0, 0, 0, 0.2));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.orbit-card-glass:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

/* --- Selection (Text Highlight) --- */
::selection {
    background: rgba(0, 243, 255, 0.3);
    color: #fff;
    text-shadow: 0 0 5px #00f3ff;
}

/* --- Glass Shimmer Effect --- */
.orbit-card-glass {
    overflow: hidden;
    /* Ensure shimmer stays inside */
}

.orbit-card-glass::after {
    content: "";
    /* Fix: Ensure content is empty string */
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 50%,
            transparent 100%);
    transform: skewX(-25deg);
    /* Slanted light */
    transition: none;
    /* Reset transition for animation */
    pointer-events: none;
}

.orbit-card-glass:hover::after {
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }

    100% {
        left: 200%;
    }
}

/* --- Dynamic Icon Animations --- */
.quick-action-card:hover i {
    animation: icon-float 0.8s ease-in-out infinite alternate;
    color: #fff;
    text-shadow: 0 0 15px var(--neon-accent);
}

@keyframes icon-float {
    0% {
        transform: translateY(0) scale(1.1);
    }

    100% {
        transform: translateY(-3px) scale(1.1);
    }
}

/* --- Staggered Entry Animations (CSS Only) --- */
.metrics-grid .metric-card {
    opacity: 0;
    /* Hidden initially */
    animation: fadeIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.metrics-grid .metric-card:nth-child(1) {
    animation-delay: 100ms;
}

.metrics-grid .metric-card:nth-child(2) {
    animation-delay: 200ms;
}

.metrics-grid .metric-card:nth-child(3) {
    animation-delay: 300ms;
}

.metrics-grid .metric-card:nth-child(4) {
    animation-delay: 400ms;
}

.dashboard-quick-actions .quick-action-card {
    opacity: 0;
    animation: fadeIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.dashboard-quick-actions .quick-action-card:nth-child(1) {
    animation-delay: 500ms;
}

.dashboard-quick-actions .quick-action-card:nth-child(2) {
    animation-delay: 600ms;
}

.dashboard-quick-actions .quick-action-card:nth-child(3) {
    animation-delay: 700ms;
}

.dashboard-quick-actions .quick-action-card:nth-child(4) {
    animation-delay: 800ms;
}


/* --- Quick Actions --- */
.dashboard-quick-actions {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    /* 5 Items now */
    gap: 15px;
    margin-bottom: 30px;
}

@media (max-width: 1200px) {
    .dashboard-quick-actions {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .dashboard-quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

.quick-action-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 160px;
}

@keyframes subtle-pulse {
    0% {
        text-shadow: 0 0 0 rgba(0, 243, 255, 0);
    }

    /* --- Pulse Effect for Key Metrics --- */
    #dashboard-total-receivables {
        animation: subtle-pulse 3s infinite;
    }

    @keyframes subtle-pulse {
        0% {
            text-shadow: 0 0 0 rgba(0, 243, 255, 0);
        }

        50% {
            text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
        }

        100% {
            text-shadow: 0 0 0 rgba(0, 243, 255, 0);
        }
    }

    /* --- Glass Modals --- */
    .orbit-modal-glass {
        background: rgba(15, 23, 42, 0.6) !important;
        /* Semi-transparent dark */
        backdrop-filter: blur(16px) !important;
        -webkit-backdrop-filter: blur(16px) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
        border-radius: 16px !important;
    }

    .orbit-modal-header {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 20px 24px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .orbit-close-btn {
        background: transparent;
        border: none;
        color: #94a3b8;
        font-size: 24px;
        cursor: pointer;
        transition: color 0.2s;
    }

    .orbit-close-btn:hover {
        color: #fff;
    }

    /* --- Modern Tables --- */
    .orbit-table-modern {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
        font-size: 13px;
        color: #cbd5e1;
    }

    .orbit-table-modern th {
        background: rgba(255, 255, 255, 0.03);
        padding: 16px;
        text-align: left;
        font-weight: 600;
        color: #94a3b8;
        border-bottom: 2px solid rgba(255, 255, 255, 0.1);
        letter-spacing: 0.05em;
    }

    .orbit-table-modern td {
        padding: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        transition: background 0.2s;
    }

    .orbit-table-modern tr:hover td {
        background: rgba(255, 255, 255, 0.02);
    }

    .orbit-table-modern tr:last-child td {
        border-bottom: none;
    }

    /* --- Status Badges (Refined) --- */
    .orbit-badge {
        padding: 4px 10px;
        border-radius: 999px;
        font-size: 11px;
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        border: 1px solid transparent;
    }

    .orbit-badge.success {
        background: rgba(0, 255, 157, 0.1);
        color: #00ff9d;
        border-color: rgba(0, 255, 157, 0.2);
    }

    .orbit-badge.warning {
        background: rgba(251, 191, 36, 0.1);
        color: #fbbf24;
        border-color: rgba(251, 191, 36, 0.2);
    }

    .orbit-badge.danger {
        background: rgba(239, 68, 68, 0.1);
        color: #ef4444;
        border-color: rgba(239, 68, 68, 0.2);
    }

    .orbit-badge.info {
        background: rgba(56, 189, 248, 0.1);
        color: #38bdf8;
        border-color: rgba(56, 189, 248, 0.2);
    }

    /* --- Mobile Horizontal Scroll Utility --- */
    .orbit-table-container {
        width: 100%;
        overflow-x: auto;
        border-radius: 8px;
        background: rgba(0, 0, 0, 0.2);
    }

    /* --- Buttons --- */
    .orbit-btn {
        padding: 8px 16px;
        border-radius: 8px;
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s;
        border: 1px solid transparent;
    }

    .orbit-btn-ghost {
        background: transparent;
        border-color: #334155;
        color: #94a3b8;
    }

    .orbit-btn-ghost:hover {
        border-color: #94a3b8;
        color: #fff;
    }

    .orbit-btn-primary {
        background: var(--brand-primary);
        color: #fff;
    }

    .orbit-btn-primary:hover {
        background: #1d4ed8;
        box-shadow: 0 0 15px rgba(37, 99, 235, 0.4);
    }

    /* --- Metrics Grid --- */
    /* --- Light Theme Overrides --- */
    body.light-theme {
        background: #f1f5f9;
        /* Light slate bg */
        color: #1e293b;
    }

    body.light-theme .orbit-card-glass,
    body.light-theme .receivables-section,
    body.light-theme .notes-section,
    body.light-theme .quick-action-card,
    body.light-theme .metric-card {
        background: rgba(255, 255, 255, 0.7);
        border: 1px solid rgba(0, 0, 0, 0.05);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    }

    body.light-theme h1,
    body.light-theme h2,
    body.light-theme h3,
    body.light-theme h4,
    body.light-theme .metric-label {
        color: #0f172a !important;
        text-shadow: none !important;
    }

    body.light-theme .metric-value {
        color: #0f172a;
    }

    body.light-theme .orbit-table-modern th {
        color: #475569;
        font-weight: 700;
    }

    body.light-theme .orbit-table-modern td {
        color: #334155;
        font-weight: 500;
    }

    body.light-theme .nexus-text-btn {
        color: #475569;
        background: rgba(0, 0, 0, 0.05);
        border-color: rgba(0, 0, 0, 0.1);
    }

    body.light-theme .nexus-text-btn:hover {
        color: #0f172a;
        background: rgba(0, 0, 0, 0.1);
    }

    /* --- Metrics Grid (Equal Sizes) --- */
    .metrics-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        /* Force 4 equal columns on desktop */
        gap: 20px;
        margin-bottom: 30px;
    }

    @media (max-width: 1024px) {
        .metrics-grid {
            grid-template-columns: repeat(2, 1fr);
            /* 2x2 on Tablets */
        }
    }

    @media (max-width: 600px) {
        .metrics-grid {
            grid-template-columns: 1fr;
            /* Stack on Mobile */
        }
    }

    .metric-card {
        padding: 24px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        height: 140px;
        /* Fixed uniform height */
        min-height: 140px;
    }

    .metric-label {
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 1px;
        color: #94a3b8;
        margin-bottom: 10px;
        font-weight: 700;
    }

    .metric-value {
        font-size: 24px;
        font-weight: 800;
        color: #fff;
        margin-bottom: 5px;
        font-family: 'Outfit', sans-serif;
        letter-spacing: -0.5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* --- Corporate Nexus --- */
    .nexus-container {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        align-items: center;
        padding: 10px 0;
    }

    .nexus-text-btn {
        color: rgba(255, 255, 255, 0.7);
        text-decoration: none;
        font-size: 13px;
        padding: 8px 16px;
        border-radius: 30px;
        /* Pill shape */
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        transition: all 0.3s ease;
        white-space: nowrap;
        font-weight: 500;
        backdrop-filter: blur(5px);
    }

    .nexus-text-btn:hover {
        color: #fff;
        background: rgba(255, 255, 255, 0.15);
        border-color: rgba(0, 243, 255, 0.5);
        box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
        transform: translateY(-2px);
    }

    /* --- Page Transitions --- */
    .page-enter {
        animation: slideInRight 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    }

    .page-exit {
        animation: fadeOutLeft 0.2s ease-in forwards;
    }

    @keyframes slideInRight {
        from {
            opacity: 0;
            transform: translateX(30px);
        }

        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    @keyframes fadeOutLeft {
        from {
            opacity: 1;
            transform: translateX(0);
        }

        to {
            opacity: 0;
            transform: translateX(-10px);
        }
    }