/* Reset and Variables */
:root {
    --bg-dark: #0f172a;
    --sidebar-bg: #1e293b;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);

    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #ec4899;
    --accent: #10b981;
    --warning: #f59e0b;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --font-sans: 'Inter', sans-serif;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    --shadow-neon: 0 0 15px rgba(59, 130, 246, 0.5);

    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    background-image: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.15), transparent 40%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: var(--shadow-md);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.logo i {
    font-size: 1.75rem;
}

.sidebar-nav {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    overflow-y: auto;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
}

.nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-btn.active {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--text-main);
    border-right: 3px solid var(--primary);
}

.nav-btn.active i {
    color: var(--primary);
}

.nav-btn i {
    font-size: 1.25rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    padding: 1.5rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(10px);
    z-index: 5;
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.page-title p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-profile i {
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.user-profile i:hover {
    color: var(--text-main);
}

.avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-neon);
}

.content-wrapper {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
    position: relative;
}

/* Tabs */
.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards & Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* Mobile App Layout */
.mobile-header {
    display: none;
    padding: 1rem 1.5rem;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 20;
}

.mobile-header .logo {
    font-size: 1.25rem;
}

.mobile-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.glass-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.5), 0 0 15px rgba(59, 130, 246, 0.2);
}

.full-width-card {
    grid-column: 1 / -1;
}

.double-width-card {
    grid-column: span 2;
}

.card-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h2 i {
    color: var(--primary);
}

/* Forms */
.dynamic-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

input,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.95rem;
    transition: var(--transition);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
    background: rgba(15, 23, 42, 0.8);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
    border: none;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(59, 130, 246, 0.6);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.form-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

/* Stats Cards */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.secondary {
    background: rgba(236, 72, 153, 0.1);
    color: var(--secondary);
}

.stat-icon.accent {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent);
}

.stat-content h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-value .unit {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.interactive-row {
    cursor: pointer;
}

.interactive-row:hover {
    background: rgba(59, 130, 246, 0.1) !important;
}

.interactive-row.selected {
    background: rgba(59, 130, 246, 0.2);
    border-left: 3px solid var(--primary);
}

/* Reports */
.report-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.report-icon {
    font-size: 3rem;
    color: #ef4444;
    /* PDF Red */
}

.report-icon.text-excel {
    color: #10b981;
    /* Excel Green */
}

.report-icon.text-boq {
    color: var(--primary);
}

.report-info h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.report-info p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.mt-3 {
    margin-top: 0.75rem;
}

.chart-container {
    height: 350px;
    position: relative;
}

/* Import Cards */
.import-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

.import-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.import-card:hover {
    background: rgba(59, 130, 246, 0.05);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 0 10px rgba(59, 130, 246, 0.2);
}

.import-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: inline-block;
}

.text-staad {
    color: #f59e0b;
}

.text-etabs {
    color: #3b82f6;
}

.text-autocad {
    color: #ef4444;
}

.text-rcdc {
    color: #10b981;
}

.import-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.import-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.upload-status {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
    transition: var(--transition);
}

.upload-status.hidden {
    display: none;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 999px;
    transition: width 0.3s ease;
}

.mt-2 {
    margin-top: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 30px rgba(59, 130, 246, 0.25);
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
    background: rgba(15, 23, 42, 0.8);
}

/* Mobile Responsive Adjustments */
@media (max-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .full-width-card {
        grid-column: 1 / -1;
    }

    .double-width-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    /* Hide sidebar, show mobile header and bottom nav */
    .sidebar {
        display: none;
        /* In a real app, this might become an off-canvas menu */
    }

    .mobile-header {
        display: flex;
    }

    /* Bottom Navigation Bar for Mobile */
    .bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        background: rgba(15, 23, 42, 0.9);
        backdrop-filter: blur(15px);
        border-top: 1px solid var(--glass-border);
        padding: 0.75rem 0.5rem;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
        /* Support for iOS safe area */
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 20;
    }

    .bottom-nav-btn {
        background: transparent;
        border: none;
        color: var(--text-muted);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
        font-size: 0.75rem;
        cursor: pointer;
        flex: 1;
        transition: var(--transition);
    }

    .bottom-nav-btn i {
        font-size: 1.5rem;
        margin-bottom: 0.1rem;
    }

    .bottom-nav-btn.active {
        color: var(--primary);
    }

    .bottom-nav-btn.active i {
        text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    }

    .main-content {
        height: calc(100vh - 60px - 70px);
        /* Height minus top bar and bottom nav */
        overflow-y: auto;
    }

    .topbar {
        display: none;
        /* Hide desktop topbar on mobile */
    }

    .content-wrapper {
        padding: 1rem;
        padding-bottom: 5rem;
        /* Ensure content isn't hidden behind bottom nav */
    }

    .cards-grid {
        grid-template-columns: 1fr;
        /* Single column on mobile */
        gap: 1rem;
    }

    .glass-card {
        padding: 1.25rem;
    }

    .card-header h2 {
        font-size: 1.1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .chart-container {
        height: 250px;
    }

    .report-card {
        padding: 1.5rem 1rem;
    }

    .import-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .import-card {
        padding: 1rem;
    }

    .import-icon {
        font-size: 2rem;
    }
}