/* ===== Test Taking Styles ===== */
:root {
    --primary: #4a6cf7;
    --primary-light: #eef1fe;
    --primary-dark: #3a5bd9;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --text-color: #2d3748;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Base Styles */
body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: #f5f7fb;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-top: 0;
    color: var(--text-color);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    gap: 0.5rem;
}

.btn i {
    font-size: 0.9em;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
    transform: translateY(-1px);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    transform: translateY(-1px);
}

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

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

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Test Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 1.5rem;
    margin-left: 250px;
    background-color: #f5f7fb;
    min-height: 100vh;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 0;
}

.top-bar h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.test-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.timer {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timer i {
    font-size: 1rem;
}

/* ===== Test Instructions ===== */
.test-instructions {
    margin-bottom: 2rem;
}

.test-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.metadata-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    background: var(--light);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.metadata-item i {
    color: var(--primary);
    font-size: 0.9em;
}

/* ===== Test Sections ===== */
.test-section {
    margin-bottom: 2rem;
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: none;
}

.test-section.active {
    display: block;
}

.section-header {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-light), #e6e9ff);
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--primary-dark);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-header h2 i {
    font-size: 1.1em;
}

.section-instructions {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.test-items {
    padding: 1.25rem;
    display: grid;
    gap: 1rem;
}

.test-item {
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.test-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.item-prompt {
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--dark);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.item-prompt i {
    color: var(--primary);
    font-size: 0.9em;
}

.item-content {
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--primary);
    font-size: 1.1rem;
    line-height: 1.6;
}

.item-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.item-actions .btn {
    min-width: 160px;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(74, 108, 247, 0.2);
}

.item-actions .btn i {
    font-size: 1em;
    margin-right: 0.5rem;
}

.item-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(74, 108, 247, 0.25);
}

/* ===== Test Navigation ===== */
.test-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.progress-container {
    flex: 1;
    max-width: 400px;
    margin: 0 1.5rem;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.progress-bar {
    height: 8px;
    width: 100%;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.progress-bar::before {
    content: '';
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary), #6b8cff);
    transition: width 0.5s ease;
    border-radius: 4px;
}

.progress-text {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
}

/* ===== Speech Recognition Modal ===== */
#speech-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#speech-modal.show {
    display: flex;
}

#speech-modal .modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

#speech-modal.show .modal-content {
    transform: translateY(0);
    opacity: 1;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.modal-header h3 {
    color: white;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-color);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    line-height: 1;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-modal:hover {
    color: var(--text-color);
    background: var(--bg-light);
}

.modal-body {
    padding: 2rem 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* ===== Recording Indicator ===== */
.recording-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 2rem 0;
    color: var(--danger);
    font-weight: 500;
}

.pulse {
    width: 12px;
    height: 12px;
    background: var(--danger);
    border-radius: 50%;
    position: relative;
}

.pulse::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--danger);
    border-radius: 50%;
    z-index: -1;
    animation: pulse 1.5s ease-out infinite;
    opacity: 0.7;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    70% {
        transform: scale(2.5);
        opacity: 0;
    }
    100% {
        opacity: 0;
    }
}

/* Recording Visualizer */
.recording-visualizer {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 80px;
    margin: 2rem 0;
    gap: 6px;
    padding: 1rem 0;
}

.recording-visualizer .bar {
    width: 8px;
    height: 10px;
    background: linear-gradient(to top, var(--primary), #6b8cff);
    border-radius: 4px;
    animation: equalize 1.5s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.1s);
    box-shadow: 0 2px 4px rgba(74, 108, 247, 0.2);
}

@keyframes equalize {
    0%, 100% {
        height: 10px;
    }
    50% {
        height: 50px;
    }
}

/* ===== Speech Result ===== */
.speech-result {
    margin-top: 2rem;
    text-align: center;
}

.attempts {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.attempt-dots {
    display: flex;
    gap: 0.5rem;
}

.attempt-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
}

.attempt-dots .dot.active {
    background: var(--primary);
}

.result-text {
    margin: 1.5rem 0;
    font-size: 1.1rem;
    background: #f8fafc;
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--primary);
}

.result-text strong {
    display: block;
    margin-top: 0.5rem;
    font-size: 1.3rem;
    color: var(--primary-dark);
    font-weight: 600;
}

.result-feedback {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    background: #f0f9f0;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d4edda;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.result-feedback.success {
    color: #155724;
    background: #d4edda;
    border-color: #c3e6cb;
}

.result-feedback.error {
    color: #721c24;
    background: #f8d7da;
    border-color: #f5c6cb;
}

/* ===== Submit Modal ===== */
#submit-modal .modal-content {
    max-width: 500px;
}

.submission-summary {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.summary-item:last-child {
    margin-bottom: 0;
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 992px) {
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .test-info {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .test-navigation {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.25rem;
    }
    
    .progress-container {
        max-width: 100%;
        width: 100%;
        margin: 0.5rem 0;
    }
    
    .modal-body {
        padding: 1.25rem;
    }
    
    .modal-footer {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .modal-footer .btn {
        flex: 1;
        min-width: 120px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}
