/*
 * Contract Risk Analysis System - Custom Styles
 * Palette derived from logo: Deep Navy (#1B2A4A) & Teal/Cyan (#17A2B8)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --primary-color: #1B2A4A;
    --primary-light: #2C3E6B;
    --secondary-color: #17A2B8;
    --secondary-light: #20C5D9;
    --bg-light: #F4F6F9;
    --surface-color: #FFFFFF;
    --text-primary: #2D3436;
    --text-muted: #6C757D;
    --border-color: #DEE2E6;
    
    /* Risk colors */
    --risk-critical: #DC3545;
    --risk-high: #FD7E14;
    --risk-medium: #FFC107;
    --risk-low: #0D6EFD;
    --risk-minimal: #198754;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    font-size: 0.95rem;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--primary-color);
}

/* Custom Navigation Header */
.navbar-custom {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    box-shadow: 0 4px 12px rgba(27, 42, 74, 0.15);
    padding: 0.8rem 1rem;
}

.navbar-custom .navbar-brand {
    font-weight: 700;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-custom .navbar-brand img {
    height: 40px;
    background: white;
    padding: 2px;
    border-radius: 4px;
}

.navbar-custom .nav-link {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    transition: color 0.25s ease;
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
    color: var(--secondary-light);
}

/* Cards & Layout */
.card-custom {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(27, 42, 74, 0.04);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    margin-bottom: 1.5rem;
}

.card-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(27, 42, 74, 0.08);
}

.card-header-custom {
    background-color: rgba(27, 42, 74, 0.02);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* Buttons */
.btn-primary-custom {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #FFFFFF;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    transition: all 0.25s ease;
}

.btn-primary-custom:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
    color: #FFFFFF;
    transform: translateY(-1px);
}

.btn-secondary-custom {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: #FFFFFF;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    transition: all 0.25s ease;
}

.btn-secondary-custom:hover {
    background-color: var(--secondary-light);
    border-color: var(--secondary-light);
    color: #FFFFFF;
    transform: translateY(-1px);
}

/* Auth Page Layout (Glassmorphism inspired) */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(27, 42, 74, 0.95) 0%, rgba(44, 62, 107, 0.9) 100%), 
                url('../images/logo.png') no-repeat center center;
    background-size: cover;
    padding: 2rem 1rem;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 480px;
    padding: 2.5rem;
}

.auth-logo {
    display: block;
    max-height: 80px;
    margin: 0 auto 1.5rem;
}

/* Quick Demo Sign In */
.demo-signin-section {
    margin-top: 1.25rem;
}

.demo-signin-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin-bottom: 1rem;
}

.demo-signin-divider::before,
.demo-signin-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.demo-signin-divider span {
    padding: 0 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.demo-signin-buttons {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.demo-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1.25rem;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    background: transparent;
    cursor: pointer;
    transition: all 0.25s ease;
    border-width: 2px;
    border-style: solid;
}

.demo-btn i {
    font-size: 0.9rem;
}

/* Admin Button - Red */
.demo-btn-admin {
    color: #DC3545;
    border-color: #DC3545;
}
.demo-btn-admin:hover {
    background: #DC3545;
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    transform: translateY(-1px);
}
.demo-btn-admin:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3);
}

/* User Button - Blue/Teal */
.demo-btn-user {
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}
.demo-btn-user:hover {
    background: var(--secondary-color);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
    transform: translateY(-1px);
}
.demo-btn-user:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(23, 162, 184, 0.3);
}

/* User Dashboard Cards */
.metric-card {
    border-left: 4px solid var(--primary-color);
}
.metric-card.success { border-left-color: var(--risk-minimal); }
.metric-card.warning { border-left-color: var(--risk-medium); }
.metric-card.danger { border-left-color: var(--risk-critical); }
.metric-card.info { border-left-color: var(--secondary-color); }

/* Custom Forms */
.form-control:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.25rem rgba(23, 162, 184, 0.15);
}

/* Global Sidebar Layout (Matches the visual design in the provided image) */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    overflow-x: hidden;
}

.sidebar-container {
    width: 270px;
    background-color: #111827;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow: hidden;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    border-right: none;
}

.sidebar-branding {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-branding img {
    height: 38px;
    background-color: #ffffff;
    padding: 3px;
    border-radius: 6px;
}

.sidebar-branding-text {
    line-height: 1.2;
}

.sidebar-branding-title {
    color: #ffffff;
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 0;
}

.sidebar-branding-sub {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--secondary-light);
    text-uppercase: uppercase;
}

.sidebar-content {
    flex-grow: 1;
    padding: 1.5rem 0;
    overflow-y: auto;
    overflow-x: hidden;
    /* Firefox Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-group-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1.5rem 0.25rem;
    margin-top: 1rem;
    margin-bottom: 0;
}

.sidebar-group-title:first-of-type {
    margin-top: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    margin: 2px 12px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.6rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.sidebar-link i {
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
}

.sidebar-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.04);
}

.sidebar-link.active {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    flex-shrink: 0;
}

.sidebar-avatar {
    width: 38px;
    height: 38px;
    background-color: var(--secondary-color);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-user-name {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: capitalize;
}

/* Webkit Custom Scrollbar for Sidebar */
#sidebarNav .sidebar-content::-webkit-scrollbar {
    width: 6px;
}

#sidebarNav .sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

#sidebarNav .sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

#sidebarNav .sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Main Content area */
.main-content-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    background-color: var(--bg-light);
}

/* Topbar styles */
.topbar-container {
    height: 70px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-btn {
    width: 38px;
    height: 38px;
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1.15rem;
    position: relative;
    transition: all 0.2s ease;
}

.topbar-btn:hover {
    background-color: #e9ecef;
    color: var(--primary-light);
}

.topbar-btn.active {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.topbar-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background-color: var(--risk-critical);
    border-radius: 50%;
    border: 1.5px solid #f8f9fa;
}

.content-body {
    padding: 2rem;
    flex-grow: 1;
}

/* Global Footer Adjustments */
footer.footer {
    background-color: var(--primary-color);
    color: rgba(255, 255, 255, 0.7);
    padding: 2rem 0;
    margin-top: auto; /* Push footer to bottom */
    border-top: 3px solid var(--secondary-color);
}

/* Admin wrapper removal utility */
.admin-layout {
    display: block;
}
.admin-content {
    padding: 0;
    background: transparent;
}

/* ======================================
   Sidebar Mobile Toggle Button (Burger)
   ====================================== */
.sidebar-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background-color: #e9ecef;
    color: var(--primary-light);
}

/* Sidebar Close Button (X) inside sidebar header */
.sidebar-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.1rem;
    cursor: pointer;
    margin-left: auto;
    padding: 4px;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.sidebar-close-btn:hover {
    color: #ffffff;
}

/* Dark Overlay Backdrop */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
    display: block;
    opacity: 1;
}

/* Body scroll lock when sidebar is open */
body.sidebar-open {
    overflow: hidden;
}

/* ======================================
   Responsive: Slide-in Drawer (< 992px)
   ====================================== */
@media (max-width: 991.98px) {
    .sidebar-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }

    .sidebar-container.open {
        transform: translateX(0);
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.3);
    }

    .main-content-container {
        height: auto;
        width: 100%;
    }

    .topbar-container {
        padding: 0 1rem;
    }

    .content-body {
        padding: 1.25rem;
    }
}

/* Desktop: hide burger and close button, keep sidebar visible */
@media (min-width: 992px) {
    .sidebar-toggle-btn {
        display: none !important;
    }

    .sidebar-close-btn {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

