/* Modern CSS with animations and better design */
:root {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --success: #4cc9f0;
    --danger: #f72585;
    --warning: #f8961e;
    --info: #4895ef;
    --light: #f8f9fa;
    --dark: #212529;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

/* Modern Navbar */
.navbar-modern {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
}

.navbar-modern .navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.navbar-modern .nav-link {
    color: var(--dark);
    font-weight: 500;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.navbar-modern .nav-link:hover {
    background: var(--gradient);
    color: white;
    transform: translateY(-2px);
}

/* Modern Cards */
.modern-card {
    background: white;
    border-radius: 20px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.modern-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modern-card .card-header {
    background: var(--gradient);
    color: white;
    padding: 1.5rem;
    border: none;
    font-weight: 600;
    font-size: 1.2rem;
}

.modern-card .card-body {
    padding: 2rem;
}

/* Dashboard Cards */
.dashboard-card {
    background: var(--gradient);
    color: white;
    border-radius: 20px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
    transition: all 0.3s ease;
}

.dashboard-card:hover::before {
    transform: rotate(45deg) translate(10%, 10%);
}

.dashboard-card .card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.dashboard-card .card-title {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.dashboard-card .card-value {
    font-size: 2.5rem;
    font-weight: 700;
}

/* Modern Buttons */
.btn-modern {
    padding: 0.8rem 2rem;
    border-radius: 50px;
    border: none;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-modern:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary-modern {
    background: var(--gradient);
    color: white;
}

.btn-primary-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(103, 117, 214, 0.4);
}

/* Modern Tables */
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.modern-table thead th {
    background: var(--gradient);
    color: white;
    padding: 1rem;
    font-weight: 600;
    border: none;
}

.modern-table tbody tr {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.modern-table tbody tr:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.modern-table tbody td {
    padding: 1rem;
    border: none;
}

/* Modern Forms */
.modern-form {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.modern-form .form-group {
    margin-bottom: 1.5rem;
}

.modern-form label {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
    display: block;
}

.modern-form .form-control {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 0.8rem 1rem;
    transition: all 0.3s ease;
}

.modern-form .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
    outline: none;
}

/* Login Container */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 30px;
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card .logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-card .logo i {
    font-size: 4rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--dark);
}

/* Exam Interface */
.exam-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.question-card {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.question-card .question-number {
    display: inline-block;
    background: var(--gradient);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 600;
    margin-bottom: 1rem;
}

.question-card .question-text {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Timer */
.timer-container {
    background: var(--gradient);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    display: inline-block;
    font-weight: 700;
    font-size: 1.5rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.timer-container.warning {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    }
}

/* Progress Bar */
.progress-modern {
    height: 10px;
    border-radius: 10px;
    background: #e0e0e0;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-modern .progress-bar {
    background: var(--gradient);
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* Question Navigator */
.question-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.question-nav-item {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.question-nav-item.answered {
    background: var(--gradient);
    color: white;
}

.question-nav-item.current {
    border: 3px solid var(--primary);
    transform: scale(1.1);
}

.question-nav-item:not(.answered) {
    background: #e0e0e0;
    color: var(--dark);
}

/* Alerts */
.modern-alert {
    border-radius: 10px;
    padding: 1rem 1.5rem;
    border: none;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.modern-alert.success {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: #1e3c72;
}

.modern-alert.error {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-card {
        margin-bottom: 1rem;
    }
    
    .login-card {
        padding: 2rem;
    }
    
    .modern-table {
        font-size: 0.9rem;
    }
    
    .question-nav-item {
        width: 35px;
        height: 35px;
    }
}

/* Loading Spinner */
.spinner-modern {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tooltips */
.tooltip-modern {
    position: relative;
    display: inline-block;
}

.tooltip-modern:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 1000;
}

/* Professional Color Scheme */
:root {
    --primary: #1e3c72;
    --primary-light: #2a4a7a;
    --secondary: #2c3e50;
    --accent: #3498db;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --gray: #95a5a6;
    --border: #dcdde1;
    --shadow: 0 2px 10px rgba(0,0,0,0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f6fa;
    color: var(--dark);
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: white;
    box-shadow: var(--shadow);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-weight: 600;
    color: var(--primary) !important;
    font-size: 1.25rem;
}

.navbar-brand i {
    color: var(--accent);
    margin-right: 0.5rem;
}

.nav-link {
    color: var(--secondary) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--accent) !important;
}

/* Cards */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    background: white;
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: var(--primary);
    border-radius: 8px 8px 0 0 !important;
}

.card-header i {
    color: var(--accent);
    margin-right: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(30, 60, 114, 0.2);
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

/* Forms */
.form-control {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    outline: none;
}

.form-label {
    font-weight: 500;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

/* Login Pages */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1.5rem;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo i {
    font-size: 3rem;
    color: var(--primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-title {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--secondary);
    font-size: 1.5rem;
    font-weight: 600;
}

/* Dashboard */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.stat-icon.blue { background: #e8f0fe; color: var(--primary); }
.stat-icon.green { background: #e8f5e9; color: var(--success); }
.stat-icon.orange { background: #fff3e0; color: var(--warning); }
.stat-icon.red { background: #fee9e7; color: var(--danger); }

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.stat-info p {
    color: var(--gray);
    margin: 0;
    font-size: 0.9rem;
}

/* Tables */
.table-responsive {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: #f8f9fa;
    padding: 1rem;
    font-weight: 600;
    color: var(--secondary);
    border-bottom: 2px solid var(--border);
    text-align: left;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: #f8f9fa;
}

/* Badges */
.badge {
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.85rem;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 6px;
    border: none;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Exam Cards */
.exam-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    height: 100%;
    transition: transform 0.2s;
}

.exam-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.exam-subject {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.exam-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
}

.exam-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    color: var(--gray);
    font-size: 0.9rem;
}

.exam-meta i {
    margin-right: 0.3rem;
    color: var(--accent);
}

/* Footer */
.footer {
    background: white;
    padding: 1.5rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--gray);
}

/* Shared Content Styles */
.shared-content-item {
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.shared-content-item.highlight {
    opacity: 1;
    background-color: #fff3cd;
    border-color: #ffc107;
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.2);
}

.shared-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--dark);
}

.shared-text img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Question Images */
.question-image {
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 0.5rem;
    background: #f8f9fa;
}

/* Quill Editor Styles */
.ql-container {
    font-family: inherit;
    font-size: 0.95rem;
}

.ql-editor {
    min-height: 150px;
}

.ql-toolbar {
    border-radius: 4px 4px 0 0;
    background: #f8f9fa;
}

/* Upload Preview */
.image-preview {
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
    border-radius: 4px;
    margin-top: 0.5rem;
    border: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .card-header {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .login-card {
        padding: 1.5rem;
    }
}