:root {
    --primary-color: #1a73e8;
    --secondary-color: #34a853;
    --danger-color: #ea4335;
    --warning-color: #fbbc04;
    --dark-gray: #202124;
    --light-gray: #f8f9fa;
    --border-radius: 8px;
    --box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark-gray);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    color: white;
    padding: 30px 0;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

header p {
    font-size: 1.2em;
    opacity: 0.95;
}

main {
    flex: 1;
}

.card {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.info-box {
    margin-top: 20px;
    padding: 15px;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.info-box p {
    color: var(--dark-gray);
    font-size: 0.95em;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

.user-info div {
    flex: 1;
}

.user-info h3 {
    margin-bottom: 5px;
}

.user-info p {
    color: #666;
    font-size: 0.9em;
}

button, .btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-size: 1em;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

button:hover, .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

.btn-secondary {
    background: #f1f3f4;
    color: var(--dark-gray);
}

.btn-secondary:hover {
    background: #e8eaed;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-success {
    background: var(--secondary-color);
}

.btn-danger {
    background: var(--danger-color);
}

.btn-warning {
    background: var(--warning-color);
    color: var(--dark-gray);
}

.hidden {
    display: none !important;
}

footer {
    text-align: center;
    padding: 20px;
    color: white;
    margin-top: 40px;
}

/* Dashboard Styles */
.dashboard-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
    gap: 20px !important;
    margin-top: 20px;
    width: 100%;
}

.dashboard-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.dashboard-card h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.dashboard-card p {
    color: #666;
    margin-bottom: 20px;
}

/* Exam Creation Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1em;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* Question Card */
.question-card {
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.question-card h4 {
    margin-bottom: 15px;
}

.code-block {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: var(--border-radius);
    margin: 10px 0;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
}

.options {
    margin-top: 15px;
}

.option {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.option:hover {
    background: #f0f7ff;
}

.option input[type="radio"] {
    margin-right: 10px;
}

.option.correct {
    background: #d4edda;
    border: 2px solid var(--secondary-color);
}

.option.incorrect {
    background: #f8d7da;
    border: 2px solid var(--danger-color);
}

/* Results */
.results-container {
    margin-top: 30px;
}

.score-display {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.score-display h2 {
    font-size: 3em;
    margin-bottom: 10px;
}

.progress-bar {
    background: rgba(255, 255, 255, 0.2);
    height: 30px;
    border-radius: 15px;
    overflow: hidden;
    margin-top: 20px;
}

.progress-fill {
    height: 100%;
    background: var(--secondary-color);
    transition: width 1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1em;
    color: #f0f7ff;
    transition: var(--transition);
}

.tab:hover {
    color: #f0f7ff;
}

.tab.active {
    color: #f0f7ff;
    border-bottom: 3px solid var(--primary-color);
    margin-bottom: -2px;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .user-info {
        flex-direction: column;
        text-align: center;
    }
    
    .tabs {
        overflow-x: auto;
    }
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--light-gray);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--dark-gray);
}

/* Results Modal Specific Styles */
.results-modal {
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.results-scroll {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    padding: 15px;
}

.modal-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.results-modal .close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    line-height: 1;
    z-index: 1001;
    background: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: var(--transition);
}

.results-modal .close:hover {
    background: var(--light-gray);
    transform: scale(1.1);
}

/* Mobile responsiveness for results modal */
@media (max-width: 768px) {
    .results-modal {
        width: 95%;
        max-height: 95vh;
        margin: 2.5% auto;
    }
    
    .results-scroll {
        max-height: 300px;
    }
}
