/* ===== Spera Enterprise Portal — Custom Styles ===== */

/* === Sidebar === */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    min-width: 250px;
    background: #1a1f2e;
    color: #c0c6d4;
    transition: width 0.3s ease, min-width 0.3s ease;
    display: flex;
    flex-direction: column;
    z-index: 1030;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 60px;
    min-width: 60px;
}

.sidebar .sidebar-brand {
    color: #e8eaf0;
    font-weight: 600;
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-brand .brand-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .submenu-icon,
.sidebar.collapsed .sidebar-header hr {
    display: none;
}

.sidebar.collapsed .sidebar-nav .nav-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    text-align: center;
}

.sidebar.collapsed .sidebar-nav .nav-link i {
    margin: 0;
    font-size: 1.25rem;
}

.sidebar.collapsed .collapse {
    display: none !important;
}

.sidebar .sidebar-header {
    min-height: 56px;
}

.sidebar-minify-btn {
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-minify-btn i {
    transform: rotate(180deg);
}

.sidebar hr {
    border-color: rgba(255,255,255,0.08);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav .nav-link {
    color: #a8aec0;
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    white-space: nowrap;
    border-radius: 0;
    transition: background-color 0.2s, color 0.2s;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #e8eaf0;
}

.sidebar-nav .nav-link.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left-color: #4f8ef7;
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 1.4rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-link .submenu-icon {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.sidebar-nav .nav-link[aria-expanded="true"] .submenu-icon {
    transform: rotate(180deg);
}

.sidebar-nav .sub-link {
    padding-left: 2.5rem !important;
    font-size: 0.85rem;
}

.sidebar-nav .sub-link i {
    font-size: 0.9rem;
    width: 1.2rem;
}

/* Sidebar scrollbar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
}

/* === Content Area === */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f4f6fa;
}

/* === Top Navbar === */
.top-navbar {
    background: #fff;
    border-bottom: 1px solid #e2e5ea;
    min-height: 56px;
}

.top-navbar .nav-link {
    color: #5a6070;
    padding: 0.4rem 0.6rem;
}

.top-navbar .nav-link:hover {
    color: #1a1f2e;
}

/* === Notifications Dropdown === */
.notifications-dropdown {
    width: 340px;
    max-height: 420px;
    overflow-y: auto;
    padding: 0;
}

.notifications-dropdown .notification-item {
    white-space: normal;
    border-bottom: 1px solid #f0f0f0;
    padding: 0.6rem 1rem;
}

.notifications-dropdown .notification-item.unread {
    border-left: 3px solid #4f8ef7;
}

.notifications-dropdown .notification-item:last-child {
    border-bottom: none;
}

.notifications-dropdown .notification-text {
    line-height: 1.35;
}

/* === Cards === */
.card {
    border-radius: 0.5rem;
}

.card-header {
    border-bottom-color: #eef0f3;
}

/* === Stat Cards === */
.stat-card {
    border-radius: 0.5rem;
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.08) !important;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #888ea8;
    font-weight: 600;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
}

/* Colored left borders for stat cards */
.stat-card {
    border-left: 4px solid transparent;
}

.stat-card:not(.stat-card-awarded) {
    border-left-color: #4f8ef7;
}

/* === Status Badge Colors === */
.badge.bg-secondary {
    background-color: #6c757d !important;
}
.badge.bg-info {
    background-color: #0dcaf0 !important;
}
.badge.bg-warning {
    background-color: #ffc107 !important;
    color: #212529 !important;
}
.badge.bg-success {
    background-color: #198754 !important;
}
.badge.bg-danger {
    background-color: #dc3545 !important;
}
.badge.bg-primary {
    background-color: #0d6efd !important;
}
.badge.bg-dark {
    background-color: #212529 !important;
}

/* === Pipeline Stages === */
.pipeline-track {
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.pipeline-stage {
    min-width: 110px;
    transition: transform 0.15s;
}

.pipeline-stage:hover {
    transform: translateY(-2px);
}

.pipeline-stage .badge {
    font-weight: 700;
}

/* === Tables === */
.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #5a6070;
    font-weight: 600;
}

.table td {
    font-size: 0.9rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(79, 142, 247, 0.04);
}

/* === Forms === */
.form-control:focus {
    border-color: #4f8ef7;
    box-shadow: 0 0 0 0.15rem rgba(79, 142, 247, 0.2);
}

.form-label {
    color: #3a4050;
}

.input-group-text {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #5a6070;
}

/* === Login Page === */
.login-page {
    background: linear-gradient(135deg, #f4f6fa 0%, #e8ecf4 100%);
    min-height: 100vh;
}

/* === Flash Messages === */
.flash-message {
    border-radius: 0.5rem;
    font-size: 0.9rem;
}

/* === Responsive === */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: -250px;
        top: 0;
        bottom: 0;
        width: 250px;
        min-width: 250px;
        z-index: 1050;
    }

    .sidebar.mobile-show {
        left: 0;
    }

    .sidebar.collapsed {
        left: -60px;
    }

    .sidebar.collapsed.mobile-show {
        left: 0;
        width: 250px;
        min-width: 250px;
    }

    .sidebar.collapsed.mobile-show .brand-text,
    .sidebar.collapsed.mobile-show .nav-text,
    .sidebar.collapsed.mobile-show .submenu-icon {
        display: inline;
    }

    .sidebar.collapsed.mobile-show .sidebar-nav .nav-link i {
        margin-right: 0.65rem;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1049;
    }

    .stat-card .stat-value {
        font-size: 1.35rem;
    }
}

@media (min-width: 992px) {
    .sidebar:not(.collapsed) ~ .content-area .d-lg-none {
        display: none;
    }
}

/* === Utility === */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.min-width-0 {
    min-width: 0;
}

/* === Print Styles === */
@media print {
    .sidebar,
    .top-navbar,
    .sidebar-backdrop,
    .btn,
    footer {
        display: none !important;
    }

    .wrapper {
        display: block;
    }

    .content-area {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }

    .table {
        font-size: 0.8rem;
    }

    body {
        font-size: 11pt;
        color: #000;
    }
}
