/* GyanRank Custom Styles */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

/* General Styles */
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.bg-gradient-danger {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.bg-gradient-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #f0f2f5;
    font-weight: 600;
    padding: 16px 20px;
}

/* Dashboard Cards */
.dashboard-card {
    border-left: 4px solid var(--primary-color);
    padding: 20px;
    border-radius: 12px;
}

.dashboard-card.success {
    border-left-color: var(--success-color);
}

.dashboard-card.danger {
    border-left-color: var(--danger-color);
}

.dashboard-card.warning {
    border-left-color: var(--warning-color);
}

.dashboard-card.info {
    border-left-color: var(--info-color);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
}

/* Buttons */
.btn {
    border-radius: 8px;
    padding: 8px 20px;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a3f92 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Forms */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 10px 15px;
    font-size: 0.92rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.form-label {
    font-weight: 500;
    margin-bottom: 6px;
    color: #495057;
    font-size: 0.9rem;
}

/* Tables */
.table {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
}

.table thead th {
    background-color: #f8f9fb;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: #6c757d;
    padding: 12px 16px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.9rem;
}

.table-hover tbody tr:hover {
    background-color: #f8f9fb;
}

.table-hover tbody tr {
    transition: background-color 0.15s ease;
}

/* Badges */
.badge {
    padding: 6px 12px;
    font-weight: 500;
    border-radius: 6px;
    font-size: 0.78rem;
    letter-spacing: 0.2px;
}

/* Badge color variants for panels */
.badge.bg-success { background: linear-gradient(135deg, #10b981, #059669) !important; }
.badge.bg-danger { background: linear-gradient(135deg, #ef4444, #dc2626) !important; }
.badge.bg-warning { background: linear-gradient(135deg, #f59e0b, #d97706) !important; color: #fff !important; }
.badge.bg-info { background: linear-gradient(135deg, #3b82f6, #2563eb) !important; }
.badge.bg-primary { background: linear-gradient(135deg, #667eea, #764ba2) !important; }

/* Institute Cards - Modern Design */
.institute-card {
    overflow: hidden;
    transition: all 0.3s ease;
}

.institute-card .institute-banner {
    height: 200px;
    object-fit: cover;
    width: 100%;
}

.institute-card .institute-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid white;
    margin-top: -40px;
    object-fit: cover;
}

/* Modern Institute Card Hover Effects */
.institute-card-modern:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.25) !important;
}

.institute-card-modern .btn:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Smooth animations for stats */
.institute-card-modern .row > div > div {
    transition: all 0.3s ease;
}

.institute-card-modern:hover .row > div > div {
    transform: translateY(-2px);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9) 0%, rgba(118, 75, 162, 0.9) 100%), url('../images/hero-bg.svg');
    background-size: cover;
    background-position: center;
    background-blend-mode: overlay;
    color: white;
    padding: 100px 0;
    text-align: center;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.hero-section p {
    font-size: 1.25rem;
    opacity: 0.95;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* Sidebar (Admin panels) */
.sidebar {
    background-color: #2c3e50;
    height: 100vh;
    padding: 0;
    position: sticky;
    top: 0;
    width: 260px;
    z-index: 1000;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 11px 20px;
    margin: 2px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.12);
    color: white;
}

.sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    font-weight: 600;
}

.sidebar .nav-link i {
    margin-right: 10px;
    width: 22px;
    font-size: 1rem;
}

.main-content {
    flex: 1;
    overflow-x: hidden;
    min-height: 100vh;
    min-width: 0;
}

.content-area {
    padding: 24px;
}

.content-area .row {
    --bs-gutter-x: 1.25rem;
    --bs-gutter-y: 1.25rem;
}

.content-area .card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.content-area .card .card-body {
    padding: 1.25rem;
}

/* Top Navbar for panels */
.top-navbar {
    border-bottom: 1px solid #eee;
    min-height: 56px;
    display: flex;
    align-items: center;
}

/* Search Box */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 40px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .sidebar {
        position: fixed;
        height: 100vh;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-area {
        padding: 16px;
    }
    
    .institute-card .institute-banner {
        height: 150px;
    }
    
    .institute-card .institute-logo {
        width: 60px;
        height: 60px;
        margin-top: -30px;
    }
    
    /* Top navbar mobile */
    .top-navbar {
        min-height: 52px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

/* Utility Classes */
.text-primary-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-sm-hover:hover {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.cursor-pointer {
    cursor: pointer;
}

/* Status Indicators */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.status-dot.active {
    background-color: var(--success-color);
}

.status-dot.inactive {
    background-color: var(--danger-color);
}

.status-dot.pending {
    background-color: var(--warning-color);
}

/* Exam Timer */
.exam-timer {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    background: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.exam-timer.warning {
    background-color: #fff3cd;
    border: 2px solid var(--warning-color);
}

.exam-timer.danger {
    background-color: #f8d7da;
    border: 2px solid var(--danger-color);
}

/* OMR Sheet */
.omr-sheet {
    position: fixed;
    right: -300px;
    top: 0;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
}

.omr-sheet.show {
    right: 0;
}

.omr-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1002;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.omr-question {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.omr-option {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border: 2px solid #dee2e6;
    border-radius: 50%;
    margin: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.omr-option:hover {
    border-color: var(--primary-color);
    background-color: #f0f8ff;
}

.omr-option.selected {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
/* ================================
   MOBILE RESPONSIVE STYLES
   ================================ */

/* Mobile Base Styles */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Cards */
    .card {
        margin-bottom: 1rem;
        border-radius: 8px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Headers */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.9rem; }
    
    /* Buttons */
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    /* Tables - Responsive */
    .table-responsive {
        border: none;
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.3rem;
        font-size: 0.85rem;
    }
    
    /* Forms */
    .form-control,
    .form-select {
        font-size: 14px;
        padding: 0.5rem 0.75rem;
    }
    
    .form-label {
        font-size: 0.875rem;
        margin-bottom: 0.25rem;
    }
    
    /* Modal */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    /* Navbar/Header adjustments */
    .navbar-brand {
        font-size: 1rem;
    }
    
    .nav-link {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Stats/Dashboard Cards */
    .dashboard-card {
        margin-bottom: 0.75rem;
    }
    
    .dashboard-card h3 {
        font-size: 1.5rem;
    }
    
    .dashboard-card h6 {
        font-size: 0.8rem;
    }
    
    /* Alerts */
    .alert {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Badges */
    .badge {
        font-size: 0.7rem;
        padding: 0.35rem 0.5rem;
    }
    
    /* Spacing utilities */
    .mb-4, .my-4 {
        margin-bottom: 1rem !important;
    }
    
    .mt-4, .my-4 {
        margin-top: 1rem !important;
    }
    
    .p-4 {
        padding: 1rem !important;
    }
    
    /* Hide on mobile */
    .d-md-none-mobile {
        display: none !important;
    }
}

/* Small Mobile - Card Layout for Tables */
@media (max-width: 576px) {
    .container-fluid {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    /* Improve table-responsive scroll experience */
    .table-responsive {
        position: relative;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    .table-responsive::-webkit-scrollbar { height: 4px; }
    .table-responsive::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
    .table-responsive::after {
        content: '';
        position: absolute;
        top: 0; right: 0; bottom: 0;
        width: 24px;
        background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
        pointer-events: none;
        z-index: 1;
    }
    .table-responsive table { min-width: 500px; }
    
    /* Table cells compact */
    .table th, .table td { padding: 8px 6px; font-size: 0.8rem; white-space: nowrap; }
    .table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.3px; }
    
    /* Convert tables to cards */
    .table-mobile-card thead {
        display: none;
    }
    
    .table-mobile-card tbody {
        display: block;
    }
    
    .table-mobile-card tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: 1rem;
        background: #fff;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    
    .table-mobile-card td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right !important;
        padding: 0.6rem 0 !important;
        border: none !important;
        border-bottom: 1px solid #f7fafc !important;
    }
    
    .table-mobile-card td:last-child {
        border-bottom: none !important;
        padding-top: 1rem !important;
    }
    
    .table-mobile-card td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #4a5568;
        text-align: left;
        font-size: 0.85rem;
        flex: 0 0 45%;
    }
    
    .table-mobile-card td[data-label="Action"]:before,
    .table-mobile-card td[data-label="Actions"]:before {
        display: none;
    }
    
    .table-mobile-card td[data-label="Action"],
    .table-mobile-card td[data-label="Actions"] {
        justify-content: center;
    }
    
    /* Full width buttons in table cards */
    .table-mobile-card .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .table-mobile-card .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Grid adjustments */
    .row.g-4 {
        row-gap: 0.75rem !important;
    }
    
    .row.g-3 {
        row-gap: 0.5rem !important;
    }
    
    /* Full width on small screens */
    .col-sm-6,
    .col-md-6,
    .col-lg-4,
    .col-lg-3 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-dialog {
        max-width: 90%;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Larger tap targets */
    .btn,
    .nav-link,
    .page-link,
    .form-check-input,
    .form-check-label {
        min-height: 44px;
        min-width: 44px;
    }
    
    .form-check-label {
        padding: 0.5rem;
    }
    
    /* Better spacing for touch */
    .list-group-item {
        padding: 1rem;
    }
    
    /* Disable hover transforms on touch */
    .card:hover {
        transform: none !important;
    }
    
    /* Sidebar nav links larger touch targets */
    .sidebar .nav-link {
        padding: 12px 20px !important;
        min-height: 44px;
    }
}

/* ========== Panel Mobile Enhancements ========== */
@media (max-width: 768px) {
    /* Dashboard stat cards - reduce font on small screens */
    .content-area .card .card-body h5 { font-size: 1.1rem; }
    .content-area .card .card-body small { font-size: 0.75rem; }
    
    /* Table action buttons: compact on mobile */
    .table .btn-group { display: flex; flex-wrap: wrap; gap: 4px; }
    .table .btn-group .btn { flex: 1 0 auto; }
    
    /* Modal full-width on mobile */
    .modal-dialog { margin: 8px; max-width: calc(100% - 16px); }
    .modal-content { border-radius: 12px; }
    .modal-header { padding: 12px 16px; }
    .modal-body { padding: 16px; }
    .modal-footer { padding: 12px 16px; }
    
    /* Form adjustments */
    .form-control, .form-select { font-size: 16px !important; /* Prevent iOS zoom */ }
    
    /* Top navbar adjustments in panels */
    .top-navbar .dropdown-menu { right: 0; left: auto; min-width: 180px; }
    .top-navbar .btn { padding: 4px 8px; font-size: 0.85rem; }
    
    /* Card header compact */
    .card-header { padding: 12px 16px; }
    .card-header h6 { font-size: 0.9rem; }
    .card-header .btn-sm { padding: 4px 10px; font-size: 0.75rem; }
    
    /* Pagination mobile */
    .pagination { flex-wrap: wrap; gap: 2px; }
    .page-link { padding: 6px 10px; font-size: 0.8rem; }
    
    /* Alert compact */
    .alert { padding: 10px 14px; font-size: 0.85rem; border-radius: 10px; }
}

@media (max-width: 576px) {
    /* Student dashboard fs-2 too large on mobile */
    .content-area .fs-2 { font-size: 1.5rem !important; }
    
    /* Progress bars in tables */
    .progress { width: 60px !important; }
    
    /* Enrollment buttons in pending */
    .content-area .d-inline form { margin-bottom: 4px; }
    
    /* Page header flex: wrap title + action button on small screens */
    .content-area > .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 8px;
    }
    .content-area > .d-flex.justify-content-between > h4 { font-size: 1rem; }
    
    /* Card footer buttons full width */
    .card-footer .btn { font-size: 0.8rem; }
    
    /* Filter forms full width */
    .content-area .row.g-2 .col-auto { width: 100%; }
    
    /* Auth pages: reduce padding on mobile */
    .container > .row > [class*="col-md-5"] .card-body,
    .container > .row > [class*="col-md-6"] .card-body { padding: 20px !important; }
}

/* ========== Mobile App-Like Enhancements ========== */
.exp-box {
    margin-top: 10px;
    padding: 10px;
    background: #f1f7ff;
    border-left: 4px solid #1E4AFF;
    border-radius: 6px;
}

.result-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 8px;
    max-width: 760px;
}

.result-breakdown-item {
    border: 1px solid #e9eef5;
    border-radius: 8px;
    background: #fff;
    padding: 10px 12px;
}

.result-breakdown-item span {
    display: block;
    color: inherit;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.1;
}

.result-breakdown-item small {
    color: #6c757d;
    font-weight: 500;
}

.question-score-chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

@media (max-width: 575.98px) {
    .result-breakdown-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .question-score-chips {
        justify-content: flex-start;
        width: 100%;
    }
}

@media (max-width: 991px) {
    /* Smooth native-like scrolling */
    html, body { scroll-behavior: smooth; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
    
    /* Disable tap highlight & text selection on interactive elements */
    button, a, .btn, .nav-link, .dropdown-item, .list-group-item { 
        -webkit-tap-highlight-color: transparent; 
        touch-action: manipulation; 
    }
    
    /* Active press feedback for buttons */
    .btn:active { transform: scale(0.97); transition: transform 0.1s; }
    
    /* Card press feedback */
    .card:active { transform: scale(0.99); transition: transform 0.1s; }
    
    /* Sticky top-navbar shadow on scroll (enhanced) - panels define their own bg via inline styles */
    .top-navbar { backdrop-filter: blur(8px); }
    
    /* Full-width forms on mobile */
    .form-control, .form-select { border-radius: 10px; }
    
    /* Larger touch targets for action dropdowns */
    .dropdown-item { padding: 10px 16px; min-height: 44px; display: flex; align-items: center; }
    
    /* Bottom safe area support */
    .content-area { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important; }
    
    /* Smooth sidebar transition */
    .sidebar { will-change: transform; backface-visibility: hidden; }
    .sidebar-overlay { will-change: opacity; }
}
