/**
 * COE - Velodrome Calendar Management System
 * Main Stylesheet
 * 
 * @version 3.0.0
 */

/* ============================================
   Root Variables
   ============================================ */
:root {
    --primary-color: #3788d8;
    --primary-dark: #2563a8;
    --primary-light: #5ca0e8;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --white-color: #ffffff;
    --border-color: #dee2e6;
    --shadow-sm: 0 .125rem .25rem rgba(0,0,0,.075);
    --shadow-md: 0 .5rem 1rem rgba(0,0,0,.15);
    --shadow-lg: 0 1rem 3rem rgba(0,0,0,.175);
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.3s ease-in-out;
}

/* ============================================
   Global Styles
   ============================================ */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--dark-color);
    background-color: #f0f2f5;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: none;
}

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

.sidebar {
    width: 260px;
    min-height: 100vh;
    background: linear-gradient(180deg, #1e3a5f 0%, #0d2137 100%);
    color: var(--white-color);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: all var(--transition-normal);
    overflow-y: auto;
}

.sidebar.sidebar-collapsed {
    width: 70px;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

.main-content.sidebar-collapsed {
    margin-left: 70px;
}

/* ============================================
   Sidebar Styles
   ============================================ */
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--white-color);
    letter-spacing: 1px;
}

.sidebar-logo span {
    color: var(--primary-light);
}

.sidebar-logo-small {
    display: none;
    font-size: 20px;
    font-weight: 700;
}

.sidebar-collapsed .sidebar-logo {
    display: none;
}

.sidebar-collapsed .sidebar-logo-small {
    display: block;
}

/* User Info */
.sidebar-user {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.3);
    margin-bottom: 10px;
}

.user-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.user-role {
    font-size: 12px;
    opacity: 0.7;
}

/* Navigation */
.sidebar-nav {
    padding: 15px 0;
}

.nav-section-title {
    padding: 10px 20px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
}

.sidebar-collapsed .nav-section-title {
    display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: var(--white-color);
}

.nav-item.active {
    background: var(--primary-color);
    color: var(--white-color);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--white-color);
}

.nav-item i {
    width: 24px;
    font-size: 16px;
    margin-right: 12px;
    text-align: center;
}

.sidebar-collapsed .nav-item i {
    margin-right: 0;
    font-size: 18px;
}

.nav-item span {
    white-space: nowrap;
}

.sidebar-collapsed .nav-item span {
    display: none;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger-color);
    color: var(--white-color);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
}

.sidebar-collapsed .nav-badge {
    display: none;
}

/* ============================================
   Top Navbar
   ============================================ */
.top-navbar {
    background: var(--white-color);
    padding: 15px 25px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 5px;
    transition: color var(--transition-fast);
}

.sidebar-toggle:hover {
    color: var(--primary-color);
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.navbar-icon {
    position: relative;
    padding: 8px;
    color: var(--secondary-color);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.navbar-icon:hover {
    color: var(--primary-color);
}

.navbar-icon i {
    font-size: 18px;
}

.navbar-icon .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger-color);
    color: var(--white-color);
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.user-dropdown:hover {
    background: var(--light-color);
}

.user-dropdown img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
}

.user-dropdown-info {
    text-align: right;
}

.user-dropdown-name {
    font-weight: 600;
    font-size: 13px;
}

.user-dropdown-role {
    font-size: 11px;
    color: var(--secondary-color);
}

/* ============================================
   Content Area
   ============================================ */
.content-area {
    padding: 25px;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--white-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 25px;
    border: none;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 20px;
}

.card-footer {
    background: var(--light-color);
    border-top: 1px solid var(--border-color);
    padding: 15px 20px;
}

/* Stat Cards */
.stat-card {
    background: var(--white-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.primary { background: rgba(55, 136, 216, 0.15); color: var(--primary-color); }
.stat-icon.success { background: rgba(40, 167, 69, 0.15); color: var(--success-color); }
.stat-icon.warning { background: rgba(255, 193, 7, 0.15); color: var(--warning-color); }
.stat-icon.danger { background: rgba(220, 53, 69, 0.15); color: var(--danger-color); }
.stat-icon.info { background: rgba(23, 162, 184, 0.15); color: var(--info-color); }

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    line-height: 1;
}

.stat-info p {
    margin: 5px 0 0;
    color: var(--secondary-color);
    font-size: 13px;
}

/* ============================================
   Calendar Styles
   ============================================ */
.calendar-container {
    background: var(--white-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

#calendar {
    font-family: inherit;
}

/* FullCalendar Overrides */
.fc {
    border: none !important;
}

.fc .fc-toolbar-title {
    font-size: 20px;
    font-weight: 600;
}

.fc .fc-button {
    background: var(--light-color);
    border-color: var(--border-color);
    color: var(--dark-color);
    font-weight: 500;
}

.fc .fc-button:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white-color);
}

.fc .fc-button-active,
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white-color);
}

.fc .fc-daygrid-day.fc-day-today {
    background: rgba(55, 136, 216, 0.1) !important;
}

.fc .fc-daygrid-day-number,
.fc .fc-col-header-cell-cushion {
    color: var(--dark-color);
    font-weight: 500;
}

.fc-event {
    border-radius: 4px;
    border: none !important;
    padding: 2px 5px;
    font-size: 12px;
    cursor: pointer;
}

.fc-event:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-sm);
}

.fc-event-title {
    font-weight: 500;
}

/* ============================================
   Tables
   ============================================ */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    background: var(--light-color);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

.table-responsive {
    border-radius: var(--radius-md);
}

/* DataTables Overrides */
.dataTables_wrapper {
    padding: 20px 0;
}

.dataTables_filter input {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 15px;
    margin-left: 10px;
}

.dataTables_length select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 5px 10px;
}

.dataTables_paginate .paginate_button {
    border-radius: var(--radius-sm) !important;
    margin: 0 2px !important;
}

.dataTables_paginate .paginate_button.current {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--white-color) !important;
}

/* ============================================
   Forms
   ============================================ */
.form-control, .form-select {
    border-radius: var(--radius-md);
    border-color: var(--border-color);
    padding: 10px 15px;
    font-size: 14px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(55, 136, 216, 0.25);
}

.form-label {
    font-weight: 500;
    margin-bottom: 5px;
}

.form-text {
    font-size: 12px;
    color: var(--secondary-color);
}

/* Input Group */
.input-group-text {
    background: var(--light-color);
    border-color: var(--border-color);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    border-radius: var(--radius-md);
    padding: 10px 20px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* ============================================
   Badges
   ============================================ */
.badge {
    padding: 5px 10px;
    font-weight: 500;
    font-size: 11px;
    border-radius: var(--radius-sm);
}

.badge-status {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   Modals
   ============================================ */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    background: var(--light-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-title {
    font-weight: 600;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 15px 25px;
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    border-radius: var(--radius-md);
    border: none;
    padding: 15px 20px;
}

.alert-success { background: rgba(40, 167, 69, 0.15); color: #155724; }
.alert-danger { background: rgba(220, 53, 69, 0.15); color: #721c24; }
.alert-warning { background: rgba(255, 193, 7, 0.15); color: #856404; }
.alert-info { background: rgba(23, 162, 184, 0.15); color: #0c5460; }

/* ============================================
   Dropdown Menu
   ============================================ */
.dropdown-menu {
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 10px 0;
}

.dropdown-item {
    padding: 10px 20px;
    font-size: 13px;
    transition: background var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--light-color);
}

.dropdown-item i {
    width: 20px;
    margin-right: 10px;
}

/* ============================================
   Login Page
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #0d2137 100%);
}

.login-box {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--white-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white-color);
    padding: 30px;
    text-align: center;
}

.login-header h1 {
    font-size: 24px;
    margin: 0 0 5px;
}

.login-header p {
    margin: 0;
    opacity: 0.8;
}

.login-body {
    padding: 30px;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
}

/* ============================================
   Charts
   ============================================ */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ============================================
   Activity List
   ============================================ */
.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon i {
    font-size: 16px;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
    margin-bottom: 3px;
}

.activity-time {
    font-size: 12px;
    color: var(--secondary-color);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 767px) {
    .content-area {
        padding: 15px;
    }
    
    .stat-card {
        margin-bottom: 15px;
    }
    
    .user-dropdown-info {
        display: none;
    }
    
    .page-title {
        font-size: 16px;
    }
    
    .card-header {
        flex-direction: column;
        gap: 10px;
    }
}

/* ============================================
   Utilities
   ============================================ */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cursor-pointer {
    cursor: pointer;
}

.hover-lift:hover {
    transform: translateY(-3px);
}

.transition-all {
    transition: all var(--transition-normal);
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state i {
    font-size: 64px;
    color: var(--border-color);
    margin-bottom: 20px;
}

.empty-state h5 {
    color: var(--secondary-color);
    margin-bottom: 10px;
}

/* Event Status Colors */
.event-status-approved { background-color: var(--success-color); }
.event-status-pending { background-color: var(--warning-color); }
.event-status-cancelled { background-color: var(--danger-color); }
.event-status-completed { background-color: var(--info-color); }

/* Priority Colors */
.priority-low { color: var(--secondary-color); }
.priority-normal { color: var(--primary-color); }
.priority-high { color: var(--warning-color); }
.priority-urgent { color: var(--danger-color); }

/* Print Styles */
@media print {
    .sidebar,
    .top-navbar,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid var(--border-color);
    }
}
