/* 
 * AQA Portal - Premium Design System
 * Inspired by PayPal/Stripe Modern Dashboards
 * Primary Color: #216055 (Teal Green)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

:root {
    /* Brand Colors */
    --primary-color: #216055;
    --primary-dark: #1a4d42;
    --primary-light: #2a7a6b;
    --primary-soft: rgba(33, 96, 85, 0.08);
    
    /* Functional Colors */
    --bg-color: #f8fafd;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    /* Layout Tokens */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --header-height: 72px;
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --box-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

/* Global Reset & Base */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f8f9fa !important;
    color: var(--text-main);
    overflow-x: hidden;
    margin: 0;
}

h1, h2, h3, h4, h5, h6, .navbar-brand {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* Main Architecture */
#wrapper {
    display: flex;
    width: 100%;
    overflow-x: hidden;
    background-color: #f8f9fa;
}

.sidebar {
    width: 250px;
    min-width: 250px;
    background: white;
    height: 100vh;
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    overflow-x: hidden;
}

.sidebar-header {
    height: 72px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

#page-content-wrapper {
    flex-grow: 1;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: 250px;
    transition: var(--transition);
}

.main-content {
    flex: 1;
    background-color: #f8f9fa !important;
}

/* Sidebar Nav */
.sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.25rem;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0.2rem 1rem;
    border-radius: 8px;
    transition: var(--transition);
    text-decoration: none;
    border: none;
    background: transparent;
    width: calc(100% - 2rem);
    text-align: left;
}

.sidebar .nav-link:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.sidebar .nav-link.active {
    background: var(--primary-soft) !important;
    color: var(--primary-color) !important;
}

.sidebar .nav-link i:first-child {
    width: 20px;
    margin-right: 12px;
    font-size: 1rem;
    display: flex;
    justify-content: center;
    color: inherit;
}

/* Collapsible Dropdown Styles */
.sidebar .nav-link.dropdown-toggle-custom {
    justify-content: space-between;
}

.sidebar .nav-link.dropdown-toggle-custom .chevron-icon {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    margin-right: 0;
    margin-left: auto;
}

.sidebar .nav-link[aria-expanded="true"] .chevron-icon {
    transform: rotate(180deg);
}

.nav-dropdown-items {
    background: rgba(0, 0, 0, 0.02); /* Slightly darker background */
    margin: 0 1rem;
    border-radius: 8px;
    padding: 0.2rem 0;
}

.nav-dropdown-items .nav-link {
    margin: 0.1rem 0;
    padding-left: 3rem !important; /* Indentation */
    width: 100%;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    flex-shrink: 0;
}

/* Top Bar Styling */
.top-bar {
    height: 72px;
    background: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid #edf2f7;
    z-index: 1000;
}

.top-bar .page-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

/* Profile Photo Locking */
.profile-photo {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    border-radius: 10px !important;
    object-fit: cover;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background-color: var(--primary-soft);
    color: var(--primary-color);
}

.vertical-divider {
    width: 1px;
    height: 24px;
    background: #edf2f7;
    margin: 0 1.25rem;
}

/* Dropdown Refinement */
.dropdown-menu {
    border: 1px solid #edf2f7;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    margin-top: 10px !important;
}

.dropdown-item {
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    color: var(--text-main);
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

.dropdown-item i {
    width: 20px;
    margin-right: 10px;
}

/* Cards */
.card {
    background: white !important;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--box-shadow-lg);
    transform: translateY(-2px);
}

.next-event-icon {
    position: absolute;
    bottom: -15px;
    right: -15px;
    font-size: 5rem;
    opacity: 0.1;
    transform: rotate(-15deg);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    color: var(--text-main);
}

/* Buttons */
.btn {
    border-radius: 8px;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

/* Stat Cards (PayPal Style) */
.stat-card-premium {
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card-premium .icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.stat-card-premium .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

.stat-card-premium .stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

#userDropdown::after {
    margin-left: 0.75rem;
    vertical-align: middle;
}

/* Badges */
.badge {
    padding: 0.5em 1em;
    font-weight: 600;
    border-radius: 6px;
}

/* Utilities */
.text-primary { color: var(--primary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }

/* Sidebar Collapsed State (Desktop Mini) */
body.sidebar-collapsed .sidebar {
    width: 70px !important;
    min-width: 70px !important;
}

body.sidebar-collapsed #page-content-wrapper {
    margin-left: 70px !important;
}

body.sidebar-collapsed .sidebar .sidebar-header span,
body.sidebar-collapsed .sidebar .nav-link span,
body.sidebar-collapsed .sidebar .sidebar-footer span,
body.sidebar-collapsed .sidebar .chevron-icon,
body.sidebar-collapsed .sidebar small {
    display: none !important;
}

body.sidebar-collapsed .sidebar .sidebar-footer {
    padding: 0.75rem 0;
}

body.sidebar-collapsed .sidebar .sidebar-footer .btn i {
    margin-right: 0 !important;
    font-size: 1.2rem;
}

body.sidebar-collapsed .sidebar .sidebar-header {
    justify-content: center;
    padding: 0;
}

body.sidebar-collapsed .sidebar .sidebar-header a {
    justify-content: center;
    width: 100%;
}

body.sidebar-collapsed .sidebar .sidebar-header .bg-primary {
    margin-right: 0 !important;
}

body.sidebar-collapsed .sidebar .nav-link {
    justify-content: center;
    padding: 0.8rem 0;
    border-radius: 0;
    margin: 0.2rem 0;
    width: 100%;
}

body.sidebar-collapsed .sidebar .nav-link i:first-child {
    margin-right: 0;
    font-size: 1.2rem;
}

body.sidebar-collapsed .nav-dropdown-items {
    margin: 0;
}

body.sidebar-collapsed .nav-dropdown-items .nav-link {
    padding-left: 0 !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: -260px;
    }
    
    #page-content-wrapper {
        margin-left: 0 !important;
    }
    
    .sidebar.show {
        left: 0;
        box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.15);
    }
    
    body.sidebar-collapsed .sidebar {
        width: 250px !important;
        min-width: 250px !important;
        left: 0;
    }
    
    body.sidebar-collapsed #page-content-wrapper {
        margin-left: 0 !important;
    }
    
    body.sidebar-collapsed .sidebar .sidebar-header span,
    body.sidebar-collapsed .sidebar .nav-link span,
    body.sidebar-collapsed .sidebar .chevron-icon,
    body.sidebar-collapsed .sidebar small {
        display: inline !important;
    }
}

/* Full Responsiveness Refinement */
@media (max-width: 767.98px) {
    .container-fluid {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .card {
        padding: 1rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    .stat-value {
        font-size: 1.5rem !important;
    }
    
    .top-bar {
        padding: 0 1rem;
    }
    
    .page-title {
        font-size: 1rem;
    }
}

/* Utilities for stacking and spacing */
.responsive-stack {
    display: flex;
    flex-direction: column;
}

@media (min-width: 992px) {
    .responsive-stack {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* Table Responsiveness */
.table-responsive {
    border: none;
}

@media (max-width: 575.98px) {
    .btn-sm {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
}

/* Button - AQA Custom Teal */
.btn-aqa {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
    font-weight: 600;
}

.btn-aqa:hover {
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    transform: translateY(-1px);
}

/* Profile Photo Upload UI */
.profile-upload-container {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto;
    cursor: pointer;
}

.profile-upload-container img {
    width: 100%;
    height: 100%;
    border-radius: 50%; /* Strictly circular as requested */
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: var(--transition);
}

.profile-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(33, 96, 85, 0.6);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: var(--transition);
}

.profile-upload-container:hover .profile-upload-overlay {
    opacity: 1;
}

.profile-upload-container:hover img {
    transform: scale(1.02);
}

/* Profile Specific Tabs */
.profile-card .nav-tabs {
    border-bottom: 2px solid #edf2f7;
}

.profile-card .nav-link {
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    padding: 1rem 1.5rem;
    position: relative;
}

.profile-card .nav-link.active {
    color: var(--primary-color);
    background: transparent;
}

.profile-card .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
}