:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ffffff;
    --dark: #0f172a;
    --darker: #020617;
    --accent: #f43f5e;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --header-height: 80px;
}

body {
    background-color: var(--darker);
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    padding-top: var(--header-height);
}

h1,
h2,
h3,
h4,
h5,
.navbar-brand {
    font-family: 'Outfit', sans-serif;
}

/* Navbar Premium Styling */
.navbar {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1.25rem 0;
    transition: all 0.3s ease;
}

.navbar .nav-link {
    font-weight: 500;
    color: #cbd5e1;
    transition: color 0.3s ease;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: var(--primary);
}

/* Glass Cards */
.glass-card {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

/* Notification Dropdown */
.notif-dropdown {
    width: 320px;
    min-width: 280px;
}

/* Truncate multi-line text */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Animated Modal Alerts */
.animate-alert-pop {
    animation: alertPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes alertPop {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.alert-icon-container {
    animation: iconBounce 1s ease-in-out infinite alternate;
}

@keyframes iconBounce {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-5px);
    }
}

.glass-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.23);
    transform: translateY(-1px);
}

/* Hero Section */
.hero-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 20% 80%, rgba(244, 63, 94, 0.1) 0%, transparent 40%);
    z-index: -1;
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.1;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
}

/* Event Cards */
.event-card {
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    border-radius: 24px;
    background: var(--dark);
    border: 1px solid var(--glass-border);
}

.event-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.event-card .card-img-top {
    border-radius: 24px 24px 0 0;
    height: 200px;
    object-fit: cover;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    80% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

.animate.slideIn {
    animation: slideIn 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

.animate.zoomIn {
    animation: zoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.animate.popIn {
    animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.dropdown-menu.animate {
    animation-duration: 0.3s;
    animation-fill-mode: both;
}

/* Forms */
.form-control,
.form-select {
    color: #fff !important;
}

.form-control:focus,
.form-select:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
    color: #fff !important;
}

.text-secondary,
.text-muted,
.text-opacity-50 {
    color: #ffffff !important;
}

/* Utils */
.text-gradient {
    background: linear-gradient(90deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.bg-blur {
    backdrop-filter: blur(10px);
}

/* ============================================
   TABLET BREAKPOINT (max-width: 991px)
   ============================================ */
@media (max-width: 991px) {

    /* Dashboard layout stacks vertically */
    .dashboard-layout {
        flex-direction: column;
    }

    .dashboard-sidebar {
        width: 100% !important;
        height: auto !important;
        position: relative !important;
        top: 0 !important;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding: 0.75rem 1rem;
        overflow: visible !important;
    }

    .dashboard-content {
        padding: 1.5rem;
    }

    /* Sidebar becomes fully expanded (no hover-collapse on touch) */
    .collapsible-sidebar {
        width: 100% !important;
        height: auto !important;
        position: relative !important;
        overflow: visible !important;
    }

    /* Always show text & labels on tablet/mobile */
    .collapsible-sidebar .sidebar-text,
    .collapsible-sidebar .sidebar-label,
    .collapsible-sidebar:not(:hover) .sidebar-text,
    .collapsible-sidebar:not(:hover) .sidebar-label {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateX(0) !important;
        transition: none !important;
    }

    /* Nav icons always show with margin */
    .collapsible-sidebar .nav-icon,
    .collapsible-sidebar:not(:hover) .nav-icon {
        font-size: 1.1rem !important;
        margin-right: 0.75rem !important;
        animation: none !important;
    }

    /* Nav links always horizontal */
    .collapsible-sidebar .nav-link,
    .collapsible-sidebar:not(:hover) .nav-link {
        justify-content: flex-start !important;
        padding: 0.65rem 1rem !important;
    }

    /* Avatar always has margin */
    .collapsible-sidebar .sidebar-avatar,
    .collapsible-sidebar:not(:hover) .sidebar-avatar {
        margin-right: 1rem !important;
    }

    .collapsible-sidebar .sidebar-content,
    .collapsible-sidebar:not(:hover) .sidebar-content {
        justify-content: flex-start !important;
    }

    /* Hide the expand hint arrow */
    .collapsible-sidebar::after {
        display: none !important;
    }

    /* Sidebar nav items horizontal scroll on mobile */
    .sidebar-nav {
        overflow-x: auto;
    }

    .sortable-nav-items {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .sortable-nav-items .nav-link {
        flex: 0 0 auto;
        padding: 0.5rem 0.85rem !important;
    }

    .sidebar-label {
        width: 100%;
        margin-top: 0.75rem;
        margin-bottom: 0.25rem;
    }
}

/* ============================================
   MOBILE BREAKPOINT (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {

    /* ---- Hero ---- */
    .hero-title {
        font-size: 2rem;
    }

    /* ---- Navigation ---- */
    .navbar {
        padding: 0.5rem 0.75rem;
    }

    .navbar-brand {
        font-size: 1.1rem;
    }

    /* Collapsed navbar menu */
    .navbar-collapse .navbar-nav {
        padding: 0.75rem 0;
        gap: 0.25rem;
    }

    /* Login/Register buttons — side by side, not full width */
    .navbar .btn {
        width: auto !important;
        display: inline-block !important;
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
        margin: 0.15rem;
    }

    /* Notification dropdown — full width on mobile */
    .dropdown-menu[style*="width: 320px"] {
        width: calc(100vw - 2rem) !important;
        min-width: unset !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        right: auto !important;
    }

    /* ---- Dashboard ---- */
    .dashboard-layout {
        flex-direction: column;
        padding: 0;
    }

    .dashboard-sidebar {
        width: 100% !important;
        height: auto !important;
        position: relative !important;
        top: 0 !important;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding: 0.75rem 1rem;
        flex-shrink: 0;
        overflow: visible !important;
    }

    /* Sidebar header more compact */
    .sidebar-header {
        margin-bottom: 0.5rem !important;
    }

    .sidebar-header .d-flex {
        margin-bottom: 0.5rem !important;
        padding-bottom: 0 !important;
    }

    .dashboard-content {
        padding: 1rem;
        width: 100%;
    }

    /* ---- Cards ---- */
    .glass-card {
        margin-bottom: 0.75rem;
        padding: 1rem;
        border-radius: 14px;
    }

    /* ---- Grid columns ---- */
    /* Only stack cols that aren't inside modals (modals handle their own) */
    .dashboard-content .col-md-4,
    .dashboard-content .col-md-6,
    .dashboard-content .col-lg-4,
    .dashboard-content .col-lg-8 {
        padding: 0.4rem;
    }

    /* ---- Forms ---- */
    .form-control,
    .form-select {
        font-size: 16px !important;
        /* Prevents zoom on iOS */
    }

    /* ---- Buttons — only full-width in main content, not in modals/nav ---- */
    .dashboard-content .btn:not(.btn-sm):not(.btn-link):not(.btn-close) {
        min-width: 100%;
        margin: 0.2rem 0;
    }

    /* Action buttons inside tables/cards should stay compact */
    .btn-sm {
        width: auto !important;
        padding: 0.3rem 0.6rem !important;
    }

    /* ---- Tables ---- */
    .table-responsive {
        font-size: 0.8rem;
    }

    .table th,
    .table td {
        padding: 0.4rem 0.5rem;
        vertical-align: middle;
        white-space: nowrap;
    }

    /* ---- Modals ---- */
    /* Center modals, give them breathing room */
    .modal-dialog {
        margin: 0.5rem auto !important;
        max-width: calc(100vw - 1rem) !important;
        width: auto !important;
        min-height: auto;
        align-items: flex-end;
    }

    /* Modal full-screen style on very small screens */
    .modal-dialog.modal-dialog-centered {
        align-items: center !important;
        min-height: calc(100svh - 1rem);
    }

    .modal-content {
        border-radius: 16px !important;
        max-height: calc(100svh - 1rem);
        display: flex;
        flex-direction: column;
    }

    .modal-header {
        padding: 1rem 1.25rem 0.75rem !important;
        flex-shrink: 0;
    }

    .modal-body {
        padding: 1rem 1.25rem !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        flex: 1;
    }

    .modal-footer {
        padding: 0.75rem 1.25rem !important;
        flex-shrink: 0;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Modal form cols — stay 2-up for date/location, stack descriptions */
    .modal-body .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .modal-body .col-md-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Modal buttons should NOT be forced full width */
    .modal-body .btn,
    .modal-footer .btn {
        width: auto !important;
        min-width: auto !important;
    }

    /* ---- Toasts ---- */
    .toast-container-custom {
        top: 3.75rem !important;
        /* Below navbar */
        right: 0.5rem !important;
        left: 0.5rem !important;
        width: auto !important;
        max-width: none !important;
    }

    .toast {
        margin-bottom: 0.4rem;
        font-size: 0.875rem;
    }

    /* ---- Pagination ---- */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.2rem;
    }

    .page-link {
        padding: 0.4rem 0.65rem;
        font-size: 0.8rem;
    }

    /* ---- Images ---- */
    img {
        max-width: 100%;
        height: auto;
    }

    /* ---- Typography ---- */
    h1 {
        font-size: 1.75rem !important;
    }

    h2 {
        font-size: 1.4rem !important;
    }

    h3 {
        font-size: 1.2rem !important;
    }

    h4 {
        font-size: 1.05rem !important;
    }

    h5 {
        font-size: 0.95rem !important;
    }

    h6 {
        font-size: 0.875rem !important;
    }

    /* ---- Spacing utilities ---- */
    .mb-5 {
        margin-bottom: 1.5rem !important;
    }

    .mt-5 {
        margin-top: 1.5rem !important;
    }

    .mb-4 {
        margin-bottom: 1.25rem !important;
    }

    .mt-4 {
        margin-top: 1.25rem !important;
    }

    /* ---- Sidebar animations — disable on touch ---- */
    .sortable-nav-items .nav-link .nav-icon {
        animation: none !important;
    }

    .sortable-nav-items .nav-link:hover .nav-icon,
    .sortable-nav-items .nav-link.active .nav-icon,
    .collapsible-sidebar:not(:hover) .nav-icon {
        animation: none !important;
    }
}

/* ============================================
   VERY SMALL SCREENS (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {

    /* Modals go nearly full screen */
    .modal-dialog {
        margin: 0.25rem auto !important;
        max-width: calc(100vw - 0.5rem) !important;
    }

    .modal-content {
        max-height: 98svh;
        border-radius: 12px !important;
    }

    /* Stack modal 2-column forms */
    .modal-body .col-md-6,
    .modal-body .col-sm-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Notification dropdown full-screen width */
    .dropdown-menu {
        width: calc(100vw - 1rem) !important;
        max-width: none !important;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    /* Toast full width */
    .toast-container-custom {
        right: 0.25rem !important;
        left: 0.25rem !important;
    }
}

.hover-white {
    transition: color 0.2s ease;
}

.hover-white:hover {
    color: #fff !important;
}

/* Dashboard Sidebar Layout */
.dashboard-layout {
    display: flex;
    min-height: calc(100vh - var(--header-height));
    background: rgba(2, 6, 23, 0.3);
    /* Subtle contrast for content area */
}

.dashboard-sidebar {
    /* Style the sidebar container which is now fixed by index.php */
    background: rgba(15, 23, 42, 0.9);
    /* Darker to stand out more */
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    padding: calc(var(--header-height) + 2.5rem) 1.5rem 2.5rem;
    /* Add padding to account for fixed header */
    display: flex;
    flex-direction: column;
}

.dashboard-content {
    flex: 1;
    padding: 0 3rem 3rem 3rem;
    overflow-y: auto;
    min-width: 0;
    width: 100%;
    /* Take full width */
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.25rem;
    margin-bottom: 0.5rem;
    border-radius: 12px;
    color: var(--secondary);
    transition: all 0.3s ease;
}

.sidebar-nav .nav-link i {
    font-size: 1.25rem;
    margin-right: 1rem;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: transparent;
    color: #ffffff;
    box-shadow: none;
    border-left: 3px solid var(--primary);
    padding-left: calc(1.25rem - 3px);
}

.sidebar-nav .nav-link:focus,
.sidebar-nav .nav-link:active {
    color: inherit;
}

.sidebar-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-left: 1.25rem;
    opacity: 0.6;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

/* Tablet / mobile sidebar handled by the responsive blocks above */

/* Calendar Utilities */
.calendar-day {
    transition: background 0.2s ease;
}

.calendar-day:hover:not(.opacity-25) {
    background: rgba(255, 255, 255, 0.03);
}

.event-dot-label {
    font-size: 0.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    transition: all 0.2s ease;
}

.event-dot-label:hover {
    transform: translateX(2px);
    background: var(--primary) !important;
    color: #fff !important;
}

.x-small {
    font-size: 0.7rem;
}

/* Password Visibility Toggle */
.password-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    border-left: 1px solid var(--glass-border) !important;
}

.password-toggle:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
}

.password-toggle:focus {
    outline: none;
    box-shadow: none;
}

/* Toast Notifications */
.toast-container {
    z-index: 2000;
}

.toast {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color: #fff;
}

.toast.bg-danger {
    border-left: 4px solid var(--accent);
}

.toast.bg-success {
    border-left: 4px solid #10b981;
}

.toast-header {
    background: transparent;
    color: #fff;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}