/* ============================================ */
/* DASHBOARD LAYOUT - SYNCED WITH MAIN.CSS */
/* ============================================ */

.view-container {
    padding: 16px !important;
    max-width: 1600px !important;
    margin: 0 auto !important;
    width: 100% !important;
}

@media (min-width: 1024px) {
    .view-container {
        padding: 20px !important;
    }
}

/* CRITICAL: ELIMINATE EXCESSIVE TOP SPACING */
.view-container>* {
    margin-top: 0 !important;
}

/* First child absolutely NO top spacing */
.view-container>*:first-child,
.view-container>div:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
    margin-bottom: 12px !important;
    /* Only 12px after header */
}

/* Subsequent sections get minimal spacing */
.view-container>*+* {
    margin-top: 12px !important;
    /* 12px between sections */
}

/* All headings ultra-compact */
.view-container h1,
.view-container h2,
.view-container h3 {
    margin: 0 !important;
    padding: 0 !important;
    margin-bottom: 4px !important;
    /* Tiny space after title */
}

/* Paragraphs and subtitles */
.view-container p {
    margin: 0 !important;
    margin-top: 2px !important;
    /* Minimal space */
}

/* Override gap-4, gap-6 etc */
.view-container .gap-4 {
    gap: 8px !important;
    /* Reduce from 16px */
}

.view-container .gap-6 {
    gap: 12px !important;
    /* Reduce from 24px */
}

/* Grid spacing compact */
.view-container .grid {
    gap: 12px !important;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0;
}

.page-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #1E2433;
    border: 1px solid #2D3548;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #2D3548;
    transform: scale(1.05);
}

/* ============================================ */
/* KPI CARDS */
/* ============================================ */

.kpi-section {
    margin-bottom: 32px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

.kpi-card {
    background: rgba(30, 36, 51, 0.4);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    gap: 16px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.4s;
}

.kpi-card:hover::before {
    opacity: 1;
}

.kpi-card:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.kpi-card.kpi-urgent {
    border-color: rgba(230, 57, 70, 0.3);
    background: linear-gradient(135deg, rgba(30, 36, 51, 0.6) 0%, rgba(45, 31, 31, 0.6) 100%);
}

.kpi-icon {
    font-size: 40px;
    line-height: 1;
}

.kpi-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-label {
    font-size: 13px;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0;
    line-height: 1;
}

.kpi-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
}

.kpi-trend.positive {
    color: #10B981;
}

.kpi-trend.negative {
    color: #EF4444;
}

.kpi-subtitle {
    font-size: 12px;
    color: #6B7280;
}

/* ============================================ */
/* CHARTS */
/* ============================================ */

.charts-section {
    margin-bottom: 32px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: #1E2433;
    border: 1px solid #2D3548;
    border-radius: 12px;
    padding: 20px;
}

.chart-header {
    margin-bottom: 16px;
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF;
    margin: 0;
}

.chart-body {
    position: relative;
    height: 250px;
}

.chart-body canvas {
    max-height: 250px !important;
}

/* ============================================ */
/* SECTION CARDS (Tabel Urgent Works, Activity) */
/* ============================================ */

.section-card {
    background: #1E2433;
    border: 1px solid #2D3548;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #2D3548;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #FFFFFF;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon {
    margin-right: 8px;
    color: #F59E0B;
}

.section-link {
    font-size: 14px;
    color: #F59E0B;
    text-decoration: none;
    transition: color 0.2s;
}

.section-link:hover {
    color: #D97706;
    text-decoration: underline;
}

/* ============================================ */
/* DATA TABLE */
/* ============================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    text-align: left;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #2D3548;
}

.data-table tbody td {
    padding: 16px 12px;
    color: #E5E7EB;
    border-bottom: 1px solid #2D3548;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: #252B3B;
}

.activity-list {
    max-height: 400px;
    /* Force scroll if taller than table */
    overflow-y: auto;
}

.text-center {
    text-align: center;
}

.view-container .badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.view-container .badge-blue {
    background: #1E3A8A;
    color: #93C5FD;
}

.view-container .badge-yellow {
    background: #78350F;
    color: #FCD34D;
}

.view-container .badge-green {
    background: #065F46;
    color: #6EE7B7;
}

.view-container .badge-red {
    background: #7F1D1D;
    color: #FCA5A5;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    background: #2463EB;
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: #1D4ED8;
}

/* ============================================ */
/* ACTIVITY LIST */
/* ============================================ */

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: #252B3B;
    border-radius: 8px;
    transition: background 0.2s;
}

.activity-item:hover {
    background: #2D3548;
}

.activity-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-time {
    font-size: 12px;
    color: #6B7280;
}

.activity-client {
    font-size: 14px;
    font-weight: 600;
    color: #E5E7EB;
}

.activity-desc {
    font-size: 13px;
    color: #9CA3AF;
}

.activity-loading {
    text-align: center;
    padding: 40px;
    color: #6B7280;
}

/* ============================================ */
/* QUICK ACTIONS */
/* ============================================ */

.quick-actions-section {
    margin-top: 32px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 16px;
}

@media (max-width: 1024px) {
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
}

.quick-action-btn {
    background: rgba(30, 36, 51, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
}

.quick-action-btn:hover {
    background: rgba(36, 99, 235, 0.1);
    border-color: rgba(36, 99, 235, 0.5);
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.action-icon {
    font-size: 32px;
    margin-bottom: 4px;
}

.action-label {
    font-size: 15px;
    font-weight: 600;
    color: #FFFFFF;
}

.action-desc {
    font-size: 12px;
    color: #6B7280;
    text-align: center;
}

/* ============================================ */
/* LOADING SPINNER */
/* ============================================*/
/* Progress & Stats Branding */
.kpi-progress-bar-fill,
.stats-bar-fill {
    background: #F59E0B !important;
}

.text-brand-yellow {
    color: #F59E0B !important;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #2D3548;
    border-top-color: #2463EB;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================ */
/* STICKY ACTIONS & BRAND COLORS (USER REQUEST) */
/* ============================================ */

/* ============================================ */
/* DASHBOARD ACTIONS & LAYOUT (PHASE 9 - IT2) */
/* ============================================ */

/* ZONA B: Quick Actions (Static Flow) - Removed Sticky/Blur */
.quick-actions-section {
    position: relative;
    margin-top: 32px;
    /* Increased to match Stats Cards mb-8 (32px) */
    margin-bottom: 0px;
    /* Removed bottom gap for continuous flow */
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    z-index: 1;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr) !important;
    /* Forces 4 columns */
    gap: 20px;
    width: 100%;
}

/* Override existing view-container padding since sticky is gone */
.view-container {
    padding-bottom: 40px;
    /* Normal padding */
}

/* Quick Action Cards (Restored Vertical Style) */
.quick-action-btn,
.action-card {
    background: #1E293B;
    /* Slate 800 */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    /* Vertical Layout */
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 140px;
    /* Restored height */
    gap: 8px;
}

.quick-action-btn:hover,
.action-card:hover {
    transform: translateY(-4px);
    border-color: #E63946;
    background: #1E293B;
    box-shadow: 0 12px 32px rgba(230, 57, 70, 0.15);
}

.action-icon {
    font-size: 32px;
    /* Restored large icon */
    margin-bottom: 8px;
    line-height: 1;
}

.action-content {
    text-align: center;
}

.action-label,
.action-title {
    font-size: 15px;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 4px;
    line-height: 1.2;
}

.action-desc,
.action-subtitle {
    display: block;
    /* Visible again */
    font-size: 11px;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* ZONA C: Primary Actions (3 Buttons) */
.primary-actions-section {
    margin-top: 12px;
    /* Small gap between sections */
    margin-bottom: 48px;
}

.primary-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.primary-btn {
    background: linear-gradient(135deg, #E63946 0%, #C92A37 100%);
    border: none;
    border-radius: 12px;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 64px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(230, 57, 70, 0.3);
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
}

.primary-btn-icon {
    font-size: 24px;
    color: #FFFFFF;
}

.primary-btn-text {
    font-size: 14px;
    font-weight: 700;
    color: #FFFFFF;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsive */
@media (max-width: 1024px) {

    .quick-actions-grid-force-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .primary-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {

    .quick-actions-grid-force-4 {
        grid-template-columns: 1fr !important;
    }

    .primary-actions-grid {
        grid-template-columns: 1fr;
    }
}

/* Badges Status - Urgent/Danger */
.view-container .badge-danger,
.view-container .badge-urgent {
    background: #E63946 !important;
    color: #FFFFFF !important;
}

/* Progress bars */
.view-container .progress-bar {
    background: linear-gradient(90deg, #E63946 0%, #F4A261 100%) !important;
}

/* Selected document highlight */
.document-card.selected {
    border: 2px solid #E63946 !important;
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.2);
}

/* ============================================ */
/* NEW SIDEBAR STYLES (MULTI-LEVEL) */
/* ============================================ */

/* Indentare Nivele */
/* Nivel 1: Secțiune principală (Header) */
.section-header {
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 11px;
    font-weight: 900;
    text-transform: none;
    /* Allow Title Case */
    color: #64748B;
    /* slate-500 */
    letter-spacing: 0.05em;
    /* Reduced spacing for mixed case */
    user-select: none;
    transition: color 0.2s;
}

.section-header:hover {
    color: #F1FAEE;
}

/* Nivel 2: Item principal (ex: TOPOGRAFIE) */
.menu-item.level-2 {
    padding-left: 24px;
    font-weight: 600;
    font-size: 14px;
}

/* Nivel 3: Sub-item (ex: Intabulare) */
.menu-item.level-3 {
    padding-left: 52px;
    /* +28px indent */
    font-weight: 400;
    font-size: 13px;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    margin-left: 24px;
    /* Align border */
}

/* Chevron Animations */
.chevron {
    width: 16px !important;
    height: 16px !important;
    font-size: 16px !important;
    transition: transform 0.2s ease;
    opacity: 0.7;
    fill: currentColor;
}

.collapsible-section {
    display: none;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.collapsible-section.expanded {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Active States */

/* Parent indirect (secțiune master) */
.section-header.has-active-descendant {
    color: #E63946;
}

/* Parent direct (sub-secțiune) */
.menu-item.has-active-child {
    background: rgba(230, 57, 70, 0.05);
    color: #E63946;
}

/* Item activ final */
.menu-item.active {
    background: rgba(230, 57, 70, 0.1);
    border-right: 3px solid #E63946;
    color: #E63946;
    font-weight: 700;
}

/* Badge Styles — scoped to sidebar */
.sidebar .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    margin-left: auto;
    line-height: 1;
}

.sidebar .badge.urgent {
    background: #E63946;
    color: #FFFFFF;
}

.sidebar .badge.info {
    background: rgba(69, 123, 157, 0.2);
    color: #457B9D;
    border: 1px solid rgba(69, 123, 157, 0.3);
}

.sidebar .badge.success {
    background: rgba(16, 185, 129, 0.2);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.sidebar .badge.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #F59E0B;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Menu Item Base Style */
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px 10px 16px;
    /* Adjusted padding */
    color: #94A3B8;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    text-decoration: none;
    cursor: pointer;
    border-radius: 0 8px 8px 0;
    margin-right: 8px;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #F1FAEE;
    padding-left: 20px;
    /* Subtle slide effect */
}

/* Icon style in menu */
.menu-item .icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

/* Helper to rotate chevron */
.collapsible.expanded .chevron {
    transform: rotate(180deg);
}

/* Specific for level-2 collapsible expanded */
.menu-item.collapsible.expanded .chevron {
    transform: rotate(90deg);
}

/* Additional fix for sidebar overflow */
#main-sidebar nav {
    overflow-y: auto;
    padding-bottom: 20px;
}

/* ============================================ */
/* CHATBOT ANIMATIONS */
/* ============================================ */

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

@keyframes fade-in-up {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fade-in-up 0.3s ease-out forwards;
}

/* ============================================ */
/* UTILITIES */
/* ============================================ */

.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================ */
/* GLOBAL PREVIEW MODAL */
/* ============================================ */

#global-preview-modal {
    background-color: rgba(2, 6, 23, 0.4);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

#global-preview-modal:not(.hidden) {
    display: flex;
}

#global-preview-modal>div:last-child {
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#preview-content-container {
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
}

#global-preview-iframe {
    background-color: #f8fafc;
}