/* Responsive CSS for MCQ Exam System */

/* Global Responsive Styles */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --breakpoint-xs: 0;
    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 992px;
    --breakpoint-xl: 1200px;
    --admin-primary: #6366f1;
    --admin-secondary: #4f46e5;
    --admin-success: #10b981;
    --admin-warning: #f59e0b;
    --admin-danger: #ef4444;
    --admin-info: #3b82f6;
    --admin-light: #f3f4f6;
    --admin-dark: #1f2937;
    --admin-gray: #9ca3af;
    --admin-white: #ffffff;
    --admin-border: #e5e7eb;
    --admin-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --menu-color: #2c3e50;
    --scroll-color: #3498db;
}

/* Base responsive container */
.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Global Form Styles */
.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
}

/* Card Responsive Styles */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 20px;
    overflow: hidden;
}

/* Table Responsive Styles */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Button Responsive Styles */
.btn {
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
}

/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

[class*="col-"] {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

/* Responsive Typography */
@media (max-width: 576px) {
    h1 {
        font-size: 1.8rem;
    }
    h2 {
        font-size: 1.6rem;
    }
    h3 {
        font-size: 1.4rem;
    }
    body {
        font-size: 0.9rem;
    }
}

/* Navigation Responsive Styles */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 1rem;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .navbar-toggler {
        padding: 0.25rem 0.5rem;
        font-size: 1rem;
    }
    
    .navbar-nav {
        padding-top: 0.5rem;
    }
    
    .nav-link {
        padding: 0.5rem 0;
    }
}

/* Login and Registration Pages */
@media (max-width: 576px) {
    .login-container,
    .register-container {
        padding: 1rem;
    }
    
    .auth-card {
        padding: 1rem;
    }
    
    .auth-title {
        font-size: 1.5rem;
    }
}

/* Exam Pages */
@media (max-width: 992px) {
    .exam-container {
        flex-direction: column;
    }
    
    .question-section {
        margin-bottom: 1rem;
    }
    
    .options-section {
        padding-left: 0;
    }
}

/* Results Pages */
@media (max-width: 768px) {
    .results-container {
        padding: 0.5rem;
    }
    
    .result-card {
        padding: 1rem;
    }
    
    .score-display {
        font-size: 1.2rem;
    }
}

/* Admin Dashboard */
@media (max-width: 992px) {
    .admin-sidebar {
        width: 60px;
    }
    
    .admin-content {
        margin-left: 60px;
    }
    
    .stats-card {
        margin-bottom: 1rem;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .admin-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Profile Page */
@media (max-width: 768px) {
    .profile-container {
        padding: 1rem;
    }
    
    .profile-card {
        padding: 1rem;
    }
    
    .profile-avatar {
        width: 100px;
        height: 100px;
    }
}

/* Question Management */
@media (max-width: 992px) {
    .question-form {
        padding: 1rem;
    }
    
    .question-preview {
        margin-top: 1rem;
    }
    
    .option-group {
        flex-direction: column;
    }
}

/* Assignment Management */
@media (max-width: 768px) {
    .assignment-container {
        padding: 0.5rem;
    }
    
    .assignment-card {
        padding: 1rem;
    }
    
    .assignment-actions {
        flex-direction: column;
    }
    
    .assignment-actions .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Group Management */
@media (max-width: 768px) {
    .group-container {
        padding: 0.5rem;
    }
    
    .group-card {
        padding: 1rem;
    }
    
    .member-list {
        max-height: 200px;
    }
}

/* Modal Responsive Styles */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-content {
        padding: 1rem;
    }
    
    .modal-header {
        padding: 0.5rem;
    }
    
    .modal-footer {
        padding: 0.5rem;
    }
}

/* Crystal Modal Styles for Admin Panel */
.admin-crystal-modal .modal-content {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 8px 32px rgba(31, 38, 135, 0.15),
        inset 0 0 80px rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 0;
    overflow: hidden;
}

.admin-crystal-modal .modal-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1));
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.5rem;
}

.admin-crystal-modal .modal-title {
    color: var(--admin-dark);
    font-weight: 600;
    font-size: 1.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-crystal-modal .modal-body {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
}

.admin-crystal-modal .modal-footer {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 1.5rem;
}

.admin-crystal-modal .btn-crystal {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(79, 70, 229, 0.9));
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.admin-crystal-modal .btn-crystal:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    background: linear-gradient(135deg, rgba(99, 102, 241, 1), rgba(79, 70, 229, 1));
}

.admin-crystal-modal .btn-crystal-secondary {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    color: var(--admin-dark);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.admin-crystal-modal .btn-crystal-secondary:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.2));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.admin-crystal-modal .close {
    color: var(--admin-dark);
    opacity: 0.7;
    text-shadow: none;
    transition: all 0.3s ease;
}

.admin-crystal-modal .close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

.admin-crystal-modal .form-control {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--admin-dark);
    transition: all 0.3s ease;
}

.admin-crystal-modal .form-control:focus {
    background: white;
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Dark Mode Crystal Modal */
@media (prefers-color-scheme: dark) {
    .admin-crystal-modal .modal-content {
        background: rgba(17, 24, 39, 0.85);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .admin-crystal-modal .modal-header,
    .admin-crystal-modal .modal-footer {
        background: linear-gradient(135deg, rgba(31, 41, 55, 0.4), rgba(17, 24, 39, 0.1));
    }

    .admin-crystal-modal .modal-title {
        color: white;
    }

    .admin-crystal-modal .form-control {
        background: rgba(31, 41, 55, 0.9);
        color: white;
        border-color: rgba(255, 255, 255, 0.1);
    }

    .admin-crystal-modal .form-control:focus {
        background: rgba(31, 41, 55, 1);
    }

    .admin-crystal-modal .btn-crystal-secondary {
        color: white;
    }

    .admin-crystal-modal .close {
        color: white;
    }
}

/* Responsive Crystal Modal */
@media (max-width: 576px) {
    .admin-crystal-modal .modal-content {
        margin: 0.5rem;
        border-radius: 15px;
    }

    .admin-crystal-modal .modal-header,
    .admin-crystal-modal .modal-footer {
        padding: 1rem;
    }

    .admin-crystal-modal .modal-body {
        padding: 1rem;
    }

    .admin-crystal-modal .btn-crystal {
        width: 100%;
        margin: 0.25rem 0;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    .container {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    body {
        background: white !important;
        font-size: 12pt;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* Utility Classes */
@media (max-width: 576px) {
    .text-sm-center {
        text-align: center !important;
    }
    
    .mt-sm-3 {
        margin-top: 1rem !important;
    }
    
    .mb-sm-3 {
        margin-bottom: 1rem !important;
    }
    
    .p-sm-2 {
        padding: 0.5rem !important;
    }
}

/* Image Responsiveness */
img {
    max-width: 100%;
    height: auto;
}

/* Form Field Responsiveness */
@media (max-width: 576px) {
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    select.form-control {
        padding-right: 1.75rem;
    }
}

/* Table Responsiveness */
@media (max-width: 768px) {
    .table-responsive {
        margin: 0 -15px;
        padding: 0 15px;
        border: 0;
    }
    
    .table th,
    .table td {
        white-space: nowrap;
    }
}

/* Navigation Pills and Tabs */
@media (max-width: 576px) {
    .nav-pills,
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-item {
        flex-shrink: 0;
    }
}

/* Toast Notifications */
@media (max-width: 576px) {
    .toast {
        width: 100%;
        max-width: none;
        margin: 0.5rem 0;
    }
}

/* Base styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    overflow-x: hidden;
}

/* Navbar styles */
.navbar {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: 600;
}

/* Card styles */
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

/* Form styles */
.form-control:focus {
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
    border-color: var(--primary-color);
}

/* Button styles */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    transform: translateY(-2px);
}

/* Table styles */
.table {
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

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

.table td {
    vertical-align: middle;
}

/* Exam container styles */
.exam-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-top: 20px;
}

/* Modern Sidebar with Enhanced Colors */
.sidebar {
    width: 280px;
    background: #4776E6;  /* fallback for old browsers */
    background: linear-gradient(165deg, #8E54E9 0%, #4776E6 100%);  /* Modern violet to blue gradient */
    color: #fff;
    position: fixed;
    height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-header {
    padding: 0 1.5rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-header .logo {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.sidebar-header .logo i {
    font-size: 1.5rem;
    background: linear-gradient(45deg, #8E54E9, #4776E6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 1.25rem;
    color: #fff;
    letter-spacing: 0.5px;
    white-space: nowrap;
    opacity: 1;
    transition: all 0.3s ease;
}

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

.sidebar-menu li {
    margin: 0.25rem 1rem;
    position: relative;
}

.sidebar-menu a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: center;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
}

.sidebar-menu .bi {
    margin-right: 1rem;
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    transition: margin 0.3s ease;
}

.menu-text {
    transition: all 0.3s ease;
    white-space: nowrap;
    opacity: 1;
    visibility: visible;
    width: auto;
}

/* Collapsed State */
.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .sidebar-header h5,
.sidebar.collapsed .menu-category {
    opacity: 0;
    visibility: hidden;
    width: 0;
}

.sidebar.collapsed .menu-text {
    opacity: 0;
    visibility: hidden;
    width: 0;
    transform: translateX(-20px);
}

.sidebar.collapsed .sidebar-menu .bi {
    margin-right: 0;
}

.sidebar.collapsed .sidebar-menu a {
    padding: 0.875rem;
    justify-content: center;
}

/* Menu Item Tooltip */
.sidebar.collapsed .sidebar-menu li a::after {
    content: attr(data-title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    margin-left: 10px;
}

.sidebar.collapsed .sidebar-menu li a:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .sidebar {
        width: 80px;
    }

    .sidebar .menu-text,
    .sidebar .sidebar-header h5,
    .sidebar .menu-category {
        opacity: 0;
        visibility: hidden;
        width: 0;
    }

    .sidebar .sidebar-menu .bi {
        margin-right: 0;
    }

    .sidebar .sidebar-menu a {
        padding: 0.875rem;
        justify-content: center;
    }

    .sidebar .sidebar-menu li a::after {
        content: attr(data-title);
        position: absolute;
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 0.5rem 0.75rem;
        border-radius: 6px;
        font-size: 0.875rem;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        pointer-events: none;
        margin-left: 10px;
    }

    .sidebar .sidebar-menu li a:hover::after {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .sidebar .menu-text,
    .sidebar .sidebar-header h5 {
        opacity: 1;
        visibility: visible;
        width: auto;
    }

    .sidebar .sidebar-menu .bi {
        margin-right: 1rem;
    }

    .sidebar .sidebar-menu a {
        padding: 0.875rem 1.25rem;
        justify-content: flex-start;
    }

    .sidebar .sidebar-menu li a::after {
        display: none;
    }
}

/* Menu Categories */
.menu-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    padding: 1.5rem 1.5rem 0.5rem;
    letter-spacing: 1px;
}

/* Toggle Button Enhancement */
.toggle-sidebar {
    position: fixed;
    left: 280px;
    top: 1.5rem;
    background: #fff;
    color: #8E54E9;
    border: none;
        width: 35px;
        height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    z-index: 1001;
}

.toggle-sidebar:hover {
    background: #8E54E9;
    color: #fff;
    transform: scale(1.1);
}

.toggle-sidebar.collapsed {
    left: 80px;
}

@media (max-width: 992px) {
    .toggle-sidebar {
        display: none;
    }
}

/* Active Menu Indicator */
.sidebar-menu a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: #fff;
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.sidebar.collapsed .sidebar-menu a.active::before {
    width: 4px;
    height: 40%;
}

/* Menu Item Badge */
.menu-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    margin-left: auto;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.sidebar-menu a.active .menu-badge {
    background: #8E54E9;
    color: #fff;
}

/* Main Content Adjustment */
.main-content {
    margin-left: 280px;
    padding: 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f8f9fa;
}

.main-content.expanded {
    margin-left: 80px;
}

/* Responsive styles for admin panel */

/* Large screens (1200px and up) */
@media (min-width: 1200px) {
    .stats-card {
        margin: 10px;
        padding: 15px;
    }
    
    .admin-content {
        margin-left: 220px;
        padding: 20px;
    }
}

/* Medium screens (992px to 1199px) */
@media (max-width: 1199px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar .nav-link span {
        display: none;
    }
    
    .admin-content {
        margin-left: 60px;
    }
    
    .stats-card {
        margin: 8px;
        padding: 12px;
    }
    
    .card-title {
        font-size: 0.9rem;
    }
    
    .table td, .table th {
        padding: 0.5rem;
    }
}

/* Small screens (768px to 991px) */
@media (max-width: 991px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
}

/* Extra small screens (up to 767px) */
@media (max-width: 767px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .admin-content {
        margin-left: 0;
        padding: 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .card {
        margin-bottom: 10px;
    }
}

/* Mobile screens (up to 575px) */
@media (max-width: 575px) {
    .container {
        padding: 5px;
    }
    
    .stats-card {
        margin: 5px 0;
        padding: 10px;
    }
    
    .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .table td, .table th {
        padding: 0.25rem;
    }
    
    .pagination {
        font-size: 0.8rem;
    }
}

/* Dark Mode Enhancement */
@media (prefers-color-scheme: dark) {
    .sidebar {
        background: linear-gradient(165deg, #8E54E9 0%, #4776E6 100%);
    }

    .sidebar-menu a {
        background: rgba(0, 0, 0, 0.2);
    }

    .sidebar-menu a:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .main-content {
        background: #1a1a1a;
        color: #fff;
    }
}

/* Admin Panel Layout */
.admin-wrapper {
    background: var(--admin-light);
    min-height: 100vh;
}

/* Stats Cards */
.stats-card {
    background: var(--admin-white);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid var(--admin-border);
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--admin-primary), var(--admin-secondary));
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--admin-shadow);
}

.stats-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--admin-primary);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.stats-label {
    color: var(--admin-gray);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Admin Content Area */
.admin-content {
    background: var(--admin-white);
    border-radius: 1rem;
    padding: 2rem;
    margin: 1rem;
    box-shadow: var(--admin-shadow);
}

/* Table Styles */
.table {
    width: 100%;
    background: var(--admin-white);
    border-radius: 0.5rem;
    overflow: hidden;
}

.table thead th {
    background: var(--admin-light);
    color: var(--admin-dark);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem;
    border-bottom: 2px solid var(--admin-border);
}

.table tbody td {
    padding: 1rem;
    color: var(--admin-dark);
    border-bottom: 1px solid var(--admin-border);
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background: var(--admin-light);
}

/* Action Buttons */
.btn-admin {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-admin-primary:hover {
    background: var(--admin-secondary);
    transform: translateY(-2px);
}

.btn-admin-success {
    background: var(--admin-success);
    color: var(--admin-white);
}

.btn-admin-danger {
    background: var(--admin-danger);
    color: var(--admin-white);
}

/* Status Badges */
.badge {
    padding: 0.35em 0.65em;
    border-radius: 9999px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--admin-success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--admin-warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--admin-danger);
}

/* Filter Section */
.filter-section {
    background: var(--admin-white);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--admin-border);
}

.filter-section .form-control {
    border: 1px solid var(--admin-border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.filter-section .form-control:focus {
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Card Headers */
.card-header {
    background: var(--admin-white);
    border-bottom: 1px solid var(--admin-border);
    padding: 1.25rem;
}

.card-header h5 {
    color: var(--admin-dark);
    font-weight: 600;
    margin: 0;
}

/* Tabs */
.nav-tabs {
    border: none;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
}

.nav-tabs .nav-link {
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    color: var(--admin-gray);
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    color: var(--admin-primary);
    background: rgba(99, 102, 241, 0.1);
}

.nav-tabs .nav-link.active {
    background: var(--admin-primary);
    color: var(--admin-white);
}

/* Progress Bars */
.progress {
    height: 0.5rem;
    background: var(--admin-light);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(to right, var(--admin-primary), var(--admin-secondary));
    border-radius: 9999px;
}

/* Dark Mode Styles */
@media (prefers-color-scheme: dark) {
    :root {
        --admin-light: #1f2937;
        --admin-dark: #f3f4f6;
        --admin-white: #111827;
        --admin-border: #374151;
        --admin-gray: #9ca3af;
    }

    .stats-card::before {
        opacity: 0.8;
    }

    .table tbody tr:hover {
        background: #2d3748;
    }

    .filter-section {
        background: #111827;
    }

    .form-control {
        background: #1f2937;
        color: #f3f4f6;
    }

    .badge-success {
        background: rgba(16, 185, 129, 0.2);
    }

    .badge-warning {
        background: rgba(245, 158, 11, 0.2);
    }

    .badge-danger {
        background: rgba(239, 68, 68, 0.2);
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .stats-card {
        margin-bottom: 1rem;
    }

    .admin-content {
        padding: 1rem;
        margin: 0.5rem;
    }

    .filter-section {
        padding: 1rem;
    }

    .table thead th {
        padding: 0.75rem;
    }

    .table tbody td {
        padding: 0.75rem;
    }

    .btn-admin {
        width: 100%;
        justify-content: center;
        margin-bottom: 0.5rem;
    }
}

/* Animation Effects */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stats-card, .admin-content, .filter-section {
    animation: fadeIn 0.5s ease-out;
}

/* Admin Panel Tabs */
.admin-tabs {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 0.5rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.admin-tabs .nav-tabs {
    border: none;
    gap: 0.5rem;
    padding: 0.25rem;
}

.admin-tabs .nav-item {
    margin: 0;
}

.admin-tabs .nav-link {
    border: none;
    padding: 0.75rem 1.5rem;
    color: var(--admin-dark);
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
    background: transparent;
}

.admin-tabs .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--admin-primary);
}

.admin-tabs .nav-link.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(79, 70, 229, 0.1));
    color: var(--admin-primary);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.1);
}

.admin-tabs .nav-link.active::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: linear-gradient(to right, var(--admin-primary), var(--admin-secondary));
    border-radius: 10px;
}

.admin-tabs .nav-link .badge {
    margin-left: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--admin-primary);
}

.admin-tabs .nav-link.active .badge {
    background: var(--admin-primary);
    color: white;
}

/* Notes Tab Content */
.notes-container {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.note-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.note-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.note-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--admin-dark);
    margin: 0;
}

.note-date {
    font-size: 0.875rem;
    color: var(--admin-gray);
}

.note-content {
    color: var(--admin-dark);
    font-size: 0.95rem;
    line-height: 1.6;
}

.note-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.note-category {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(99, 102, 241, 0.1);
    color: var(--admin-primary);
}

.note-actions {
    display: flex;
    gap: 0.5rem;
}

.note-actions button {
    padding: 0.25rem 0.5rem;
    border: none;
    background: transparent;
    color: var(--admin-gray);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.note-actions button:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--admin-primary);
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .admin-tabs {
        background: rgba(17, 24, 39, 0.4);
    }

    .admin-tabs .nav-link {
        color: rgba(255, 255, 255, 0.8);
    }

    .admin-tabs .nav-link:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    .admin-tabs .nav-link.active {
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(79, 70, 229, 0.2));
        color: var(--admin-primary);
    }

    .notes-container {
        background: rgba(17, 24, 39, 0.4);
    }

    .note-card {
        background: rgba(31, 41, 55, 0.9);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .note-title {
        color: white;
    }

    .note-content {
        color: rgba(255, 255, 255, 0.8);
    }

    .note-footer {
        border-top-color: rgba(255, 255, 255, 0.1);
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .admin-tabs {
        padding: 0.25rem;
        border-radius: 12px;
    }

    .admin-tabs .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .notes-container {
        padding: 1rem;
    }

    .note-card {
        padding: 1rem;
    }

    .note-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .note-footer {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .note-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Responsive styles for all pages */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* Extra Large screens (≥1200px) - Default Bootstrap styles */

/* Large screens (≥992px and <1200px) */
@media (max-width: 1199.98px) {
    .container {
        max-width: 960px;
    }
    
    h1, .h1 {
        font-size: 2.25rem;
    }
    
    h2, .h2 {
        font-size: 1.75rem;
    }
    
    .card-deck .card {
        flex: 0 0 calc(50% - 30px);
        margin-bottom: 30px;
    }
}

/* Medium screens (≥768px and <992px) */
@media (max-width: 991.98px) {
    .container {
        max-width: 720px;
    }
    
    h1, .h1 {
        font-size: 2rem;
    }
    
    h2, .h2 {
        font-size: 1.5rem;
    }
    
    .navbar-toggler {
        display: block;
    }
    
    .navbar-collapse {
        background-color: var(--light-color);
        border-radius: 0.25rem;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        margin-top: 0.5rem;
        padding: 0.5rem;
        position: absolute;
        right: 1rem;
        top: 100%;
        z-index: 1000;
    }
    
    .card-deck .card {
        flex: 0 0 100%;
    }
    
    /* Admin layout adjustments */
    .sidebar {
        width: 60px;
    }
    
    .sidebar .menu-text {
        display: none;
    }
    
    .main-content {
        margin-left: 60px;
    }
    
    .toggle-sidebar {
        left: 70px;
    }
    
    /* Dashboard cards */
    .dashboard-card {
        margin-bottom: 1rem;
    }
    
    /* Stacked buttons */
    .btn-group {
        display: flex;
        flex-direction: column;
    }
    
    .btn-group .btn {
        margin-bottom: 0.25rem;
        width: 100%;
    }
}

/* Small screens (≥576px and <768px) */
@media (max-width: 767.98px) {
    .container {
        max-width: 540px;
    }
    
    h1, .h1 {
        font-size: 1.75rem;
    }
    
    h2, .h2 {
        font-size: 1.25rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    /* Table responsive improvements */
    .table-responsive table {
        min-width: 650px;
    }
    
    /* Two column forms become one column */
    .row .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Admin layout adjustments */
    .main-content {
        margin-left: 0;
        padding: 0.75rem;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: -250px;
        width: 250px;
        height: 100vh;
        z-index: 1050;
        transition: left 0.3s ease;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .sidebar .menu-text {
        display: inline;
    }
    
    /* Mobile sidebar overlay */
    .sidebar-overlay {
        background-color: rgba(0, 0, 0, 0.5);
        height: 100vh;
        left: 0;
        opacity: 0;
        position: fixed;
        top: 0;
        transition: opacity 0.3s ease;
        visibility: hidden;
        width: 100vw;
        z-index: 1040;
    }
    
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
    
    /* Mobile navigation */
    .navbar-nav {
        flex-direction: column;
    }
    
    .navbar-nav .nav-item {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    /* Login form */
    .form-signin {
        padding: 1rem;
    }
}

/* Extra small screens (<576px) */
@media (max-width: 575.98px) {
    body {
        font-size: 0.875rem;
    }
    
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    h1, .h1 {
        font-size: 1.5rem;
    }
    
    h2, .h2 {
        font-size: 1.2rem;
    }
    
    .navbar {
        padding: 0.5rem;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    /* Button groups stack vertically */
    .btn-group, .btn-group-vertical {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    .btn-group > .btn, .btn-group-vertical > .btn {
        width: 100%;
        margin-bottom: 0.25rem;
        border-radius: 0.25rem !important;
    }
    
    /* Cards full width */
    .card {
        width: 100%;
    }
    
    /* Form elements full width */
    .form-control, .form-select {
        width: 100%;
    }
    
    /* Dashboard cards stretch full width */
    .col-md-3, .col-md-4, .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Tables become more compact */
    .table th, .table td {
        padding: 0.5rem;
    }
    
    /* Action buttons become smaller */
    .action-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Login form */
    .form-signin {
        max-width: 100%;
        padding: 0.75rem;
    }
}

/* Print styles */
@media print {
    .no-print, .no-print * {
        display: none !important;
    }
    
    .navbar, .sidebar, .nav-tabs, footer, .action-buttons, button:not(.print-only) {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    body {
        padding: 0;
        background: #fff;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .container {
        max-width: 100%;
    }
}

/* iPhone SE (2nd gen) specific adjustments */
@media screen and (max-width: 375px) {
    .container {
        padding-left: 5px;
        padding-right: 5px;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .form-control, .form-select, .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.5rem;
    }
}

/* Fix for very small screens */
@media screen and (max-width: 320px) {
    html {
        font-size: 14px;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Ensure mobile-friendly tables */
@media screen and (max-width: 767.98px) {
    /* Convert tables to cards on mobile */
    .mobile-friendly-table thead {
        display: none;
    }
    
    .mobile-friendly-table tbody tr {
        display: block;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
        margin-bottom: 1rem;
        padding: 0.75rem;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }
    
    .mobile-friendly-table tbody td {
        display: block;
        text-align: right;
        padding: 0.5rem;
        border: none;
        position: relative;
        padding-left: 50%;
    }
    
    .mobile-friendly-table tbody td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        text-align: left;
        font-weight: bold;
    }
    
    .mobile-friendly-table tbody td:not(:last-child) {
        border-bottom: 1px solid #f0f0f0;
    }
}

/* Helper classes for responsive designs */
.d-xs-none {
    display: none !important;
}

@media (min-width: 576px) {
    .d-xs-none {
        display: initial !important;
    }
    
    .d-sm-none {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .d-sm-none {
        display: initial !important;
    }
    
    .d-md-none {
        display: none !important;
    }
}

@media (min-width: 992px) {
    .d-md-none {
        display: initial !important;
    }
    
    .d-lg-none {
        display: none !important;
    }
}

@media (min-width: 1200px) {
    .d-lg-none {
        display: initial !important;
    }
    
    .d-xl-none {
        display: none !important;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body.auto-dark-mode {
        background-color: #121212;
        color: #f8f9fa;
    }
    
    .auto-dark-mode .card,
    .auto-dark-mode .navbar,
    .auto-dark-mode .form-control,
    .auto-dark-mode .form-select {
        background-color: #212121;
        border-color: #444;
        color: #f8f9fa;
    }
    
    .auto-dark-mode .btn-outline-primary {
        color: #90caf9;
        border-color: #90caf9;
    }
    
    .auto-dark-mode .btn-outline-primary:hover {
        background-color: #90caf9;
        color: #121212;
    }
}

/* Flex utilities for responsive layouts */
.flex-even {
    flex: 1 1 0;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-column-sm {
    display: flex;
}

@media (max-width: 767.98px) {
    .flex-column-sm {
        flex-direction: column;
    }
}

/* Hide scrollbar for cleaner mobile view */
.scrollbar-hidden {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hidden::-webkit-scrollbar {
    display: none;
}

/* CSS Grid helpers */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

@media (max-width: 767.98px) {
    .grid-container {
        grid-template-columns: 1fr;
    }
}

/* Mobile-specific navigation drawer */
.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 80%;
    max-width: 300px;
    background-color: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 2000;
    overflow-y: auto;
}

.mobile-drawer.show {
    transform: translateX(0);
}

.mobile-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 1999;
}

.mobile-drawer-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Adjust table responsiveness */
@media (max-width: 767.98px) {
    .table-collapse-sm td {
        display: block;
        width: 100%;
        text-align: left;
        padding: 0.5rem;
        border: 0;
    }
    
    .table-collapse-sm td:before {
        content: attr(data-title);
        display: block;
        font-weight: bold;
        margin-bottom: 0.25rem;
    }
    
    .table-collapse-sm tr {
        display: block;
        border: 1px solid #dee2e6;
        margin-bottom: 1rem;
        border-radius: 0.25rem;
        padding: 0.5rem;
    }
    
    .table-collapse-sm thead {
        display: none;
    }
} 