/* ======== RESPONSIVE DESIGN STYLES ========= */

/* Sidebar minimize/expand functionality */
.custom-sidebar {
    transition: width 0.3s ease, transform 0.3s ease;
}

.custom-sidebar.minimized {
    width: 60px !important;
}

.custom-sidebar.minimized .nav-link {
    padding: 0.8rem 0.5rem;
    justify-content: center;
}

.custom-sidebar.minimized .nav-link i {
    margin-right: 0;
    font-size: 18px;
}

.custom-sidebar.minimized .nav-link span {
    display: none;
}

.custom-sidebar.minimized .nav-link:hover::after {
    content: attr(data-title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-left: 10px;
}

.content {
    transition: margin-left 0.3s ease, width 0.3s ease;
}

.content.expanded {
    margin-left: 60px !important;
    width: calc(100% - 60px) !important;
}

/* Sidebar toggle button */
.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    cursor: pointer;
}

.sidebar-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Base responsive breakpoints */
@media (max-width: 1200px) {
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .custom-sidebar {
        width: 220px;
    }
    
    .content {
        margin-left: 220px;
        width: calc(100% - 220px);
    }
}

@media (max-width: 992px) {
    /* Tablet styles */
    .custom-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1050;
    }
    
    .custom-sidebar.show {
        transform: translateX(0);
    }
    
    .custom-sidebar.minimized {
        width: 250px !important;
    }
    
    .custom-sidebar.minimized .nav-link span {
        display: inline;
    }
    
    .content {
        margin-left: 0;
        width: 100%;
    }
    
    .content.expanded {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .navbar-toggler {
        display: block !important;
    }
    
    .welcome-text {
        font-size: 48px !important;
    }
    
    .card {
        margin-bottom: 20px;
    }
    
    /* Responsive tables */
    .table-responsive {
        overflow-x: auto;
    }
    
    /* Responsive forms */
    .form-group {
        margin-bottom: 15px;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .btn-group .btn {
        width: auto;
    }
}

@media (max-width: 768px) {
    /* Mobile styles */
    body {
        font-size: 14px;
    }
    
    .custom-header {
        padding: 10px 15px;
        height: 60px;
    }
    
    .navbar-brand {
        font-size: 18px;
    }
    
    .brand-logo {
        width: 30px;
        height: 30px;
    }
    
    .welcome-text {
        font-size: 36px !important;
        line-height: 1.2;
    }
    
    .welcome-section {
        padding: 20px 0;
    }
    
    /* Mobile navigation */
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        color: white;
        font-size: 24px;
        padding: 5px;
    }
    
    .sidebar-toggle {
        display: none !important;
    }
    
    .desktop-menu {
        display: none;
    }
    
    /* Mobile sidebar overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        display: none;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .custom-sidebar {
        width: 280px;
        max-width: 85vw;
    }
    
    /* Mobile cards */
    .card {
        margin-bottom: 15px;
    }
    
    .card-img-top {
        height: 150px;
        object-fit: cover;
    }
    
    /* Mobile forms */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    /* Mobile buttons */
    .btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    /* Mobile dropdowns */
    .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        margin-top: 10px;
    }
    
    /* Mobile tables */
    .table {
        font-size: 12px;
    }
    
    .table td, .table th {
        padding: 8px 4px;
    }
}

@media (max-width: 576px) {
    /* Small mobile styles */
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .welcome-text {
        font-size: 28px !important;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    /* Stack columns on very small screens */
    .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Mobile-friendly navigation */
    .navbar-nav {
        text-align: center;
    }
    
    .nav-link {
        padding: 12px 15px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    /* Mobile exam interface */
    .question-container {
        padding: 15px;
    }
    
    .question-text {
        font-size: 16px;
        line-height: 1.4;
    }
    
    .option-label {
        display: block;
        padding: 10px;
        margin: 5px 0;
        border: 1px solid #ddd;
        border-radius: 5px;
        cursor: pointer;
    }
    
    .option-label:hover {
        background-color: #f8f9fa;
    }
    
    /* Mobile results display */
    .result-card {
        margin-bottom: 15px;
        padding: 15px;
    }
    
    .progress {
        height: 20px;
    }
    
    /* Mobile feedback form */
    .feedback-form {
        padding: 15px;
    }
    
    .rating-stars {
        font-size: 24px;
    }
}

/* ======== RESPONSIVE UTILITIES ========= */

/* Hide elements on mobile */
@media (max-width: 768px) {
    .d-desktop {
        display: none !important;
    }
    
    .d-mobile {
        display: block !important;
    }
}

@media (min-width: 769px) {
    .d-desktop {
        display: block !important;
    }
    
    .d-mobile {
        display: none !important;
    }
}

/* ======== RESPONSIVE COMPONENTS ========= */

/* Responsive navigation */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #ddd;
    z-index: 1000;
    display: none;
}

@media (max-width: 768px) {
    .mobile-nav {
        display: block;
    }
    
    .mobile-nav .nav-link {
        text-align: center;
        padding: 8px;
        font-size: 12px;
    }
    
    .mobile-nav .nav-link i {
        display: block;
        font-size: 18px;
        margin-bottom: 4px;
    }
}

/* Responsive exam interface */
.exam-container {
    max-width: 100%;
    overflow-x: hidden;
}

.question-navigation {
    position: sticky;
    top: 0;
    background: white;
    z-index: 100;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}

@media (max-width: 768px) {
    .question-navigation {
        padding: 5px 0;
    }
    
    .question-nav-btn {
        padding: 5px 8px;
        font-size: 12px;
        margin: 2px;
    }
}

/* Responsive dashboard cards */
.dashboard-card {
    transition: transform 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .dashboard-card {
        margin-bottom: 15px;
    }
    
    .dashboard-card .card-img-top {
        height: 120px;
    }
}

/* Responsive forms */
.form-responsive {
    max-width: 100%;
}

@media (max-width: 768px) {
    .form-responsive .form-group {
        margin-bottom: 15px;
    }
    
    .form-responsive .form-control {
        font-size: 16px;
    }
    
    .form-responsive .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Responsive tables */
.table-responsive-custom {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .table-responsive-custom table {
        min-width: 600px;
    }
    
    .table-responsive-custom th,
    .table-responsive-custom td {
        white-space: nowrap;
        padding: 8px 4px;
    }
}

/* Responsive modals */
.modal-responsive {
    margin: 10px;
}

@media (max-width: 576px) {
    .modal-responsive {
        margin: 5px;
    }
    
    .modal-responsive .modal-body {
        padding: 15px;
    }
}

/* Responsive charts and graphs */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

@media (max-width: 768px) {
    .chart-container {
        height: 200px;
    }
}

/* Responsive images */
.img-responsive {
    max-width: 100%;
    height: auto;
}

/* Responsive text */
.text-responsive {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 768px) {
    .text-responsive {
        font-size: 14px;
        line-height: 1.4;
    }
}

/* ======== ACCESSIBILITY IMPROVEMENTS ========= */

/* Focus styles for better accessibility */
.btn:focus,
.form-control:focus,
.nav-link:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .form-control {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ======== PRINT STYLES ========= */

@media print {
    .custom-header,
    .custom-sidebar,
    .mobile-nav,
    .btn,
    .navbar {
        display: none !important;
    }
    
    .content {
        margin: 0 !important;
        width: 100% !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
}
