/**
 * Railway Signalling MCQ Application Styles
 * Modern railway-themed design with Bootstrap customization
 */

/* Global Styles */
:root {
    --railway-blue: #003d82;
    --railway-red: #dc3545;
    --railway-green: #28a745;
    --railway-yellow: #ffc107;
    --railway-orange: #fd7e14;
    --railway-gray: #6c757d;
    --railway-light: #f8f9fa;
    --railway-dark: #343a40;
    --gradient-primary: linear-gradient(135deg, var(--railway-blue) 0%, #0056b3 100%);
    --gradient-success: linear-gradient(135deg, var(--railway-green) 0%, #20c997 100%);
    --gradient-danger: linear-gradient(135deg, var(--railway-red) 0%, #c82333 100%);
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect fill="%23ffffff10" width="50" height="50"/><rect fill="%23ffffff05" x="50" y="50" width="50" height="50"/></svg>');
    background-size: 20px 20px;
    z-index: -1;
}

/* Header Styles */
header {
    background: var(--gradient-primary) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header h1 {
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Card Styles */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: var(--gradient-primary) !important;
    border-bottom: none;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Progress Bar Styles */
.progress {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    background: var(--gradient-success);
    transition: width 0.6s ease;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Score Board Cards */
.card .card-body {
    padding: 1.5rem;
}

.card .card-body i {
    opacity: 0.8;
    transition: transform 0.3s ease;
}

.card:hover .card-body i {
    transform: scale(1.1);
}

/* Question Styles */
.question-text {
    font-size: 1.2rem;
    font-weight: 500;
    line-height: 1.6;
    color: var(--railway-dark);
    background: var(--railway-light);
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 5px solid var(--railway-blue);
    margin-bottom: 1.5rem;
}

/* Option Buttons */
.option-button {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--railway-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
}

.option-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.option-button:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: var(--railway-blue);
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 61, 130, 0.2);
}

.option-button:hover:not(:disabled)::before {
    left: 100%;
}

.option-button:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

.option-button.correct {
    background: var(--gradient-success);
    color: white;
    border-color: var(--railway-green);
    animation: correctPulse 0.6s ease;
}

.option-button.incorrect {
    background: var(--gradient-danger);
    color: white;
    border-color: var(--railway-red);
    animation: shake 0.6s ease;
}

.option-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background: var(--railway-blue);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    margin-right: 1rem;
    flex-shrink: 0;
}

.option-button.correct .option-letter,
.option-button.incorrect .option-letter {
    background: white;
    color: var(--railway-dark);
}

/* Animations */
@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Feedback Alert Styles */
#answer-feedback .alert {
    border-radius: 10px;
    border: none;
    animation: slideIn 0.5s ease;
}

.alert-success {
    background: var(--gradient-success);
    color: white;
}

.alert-danger {
    background: var(--gradient-danger);
    color: white;
}

/* Button Styles */
.btn {
    border-radius: 25px;
    padding: 0.5rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--gradient-primary);
    box-shadow: 0 4px 15px rgba(0, 61, 130, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 61, 130, 0.4);
}

.btn-success {
    background: var(--gradient-success);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.btn-outline-secondary {
    border: 2px solid var(--railway-gray);
    color: var(--railway-gray);
}

.btn-outline-secondary:hover {
    background: var(--railway-gray);
    transform: translateY(-2px);
}

/* Loading State */
#loading-state {
    padding: 3rem;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* Quiz Complete Styles */
#quiz-complete {
    text-align: center;
    padding: 2rem;
}

.fa-trophy {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    60% { transform: translateY(-10px); }
}

/* Footer Styles */
footer {
    margin-top: auto;
    background: var(--railway-dark) !important;
}

/* Responsive Design */
@media (max-width: 992px) {
    header .row {
        text-align: center;
    }
    
    header .col-md-8,
    header .col-md-4 {
        text-align: center !important;
        margin-bottom: 1rem;
    }
    
    .d-flex.justify-content-md-end {
        justify-content: center !important;
    }
}

@media (max-width: 768px) {
    .question-text {
        font-size: 1.1rem;
        padding: 1rem;
        line-height: 1.5;
    }
    
    .option-button {
        font-size: 1rem;
        padding: 1rem;
        min-height: 60px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .option-letter {
        width: 35px;
        height: 35px;
        font-size: 1rem;
        margin-right: 1rem;
        flex-shrink: 0;
    }
    
    .card .card-body {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 1.3rem;
    }
    
    header p {
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .progress {
        height: 30px;
    }
    
    .card-header h5 {
        font-size: 1.1rem;
    }
    
    .fa-2x {
        font-size: 1.5em !important;
    }
    
    .text-center .small {
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .row > .col-6 {
        margin-bottom: 0.8rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
    
    .question-text {
        font-size: 1rem;
        padding: 0.8rem;
    }
    
    .option-button {
        padding: 0.8rem;
        min-height: 55px;
        font-size: 0.95rem;
    }
    
    .option-letter {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
        margin-right: 0.8rem;
    }
    
    header h1 {
        font-size: 1.2rem;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
        min-height: 40px;
    }
    
    .progress {
        height: 25px;
    }
    
    .fa-2x {
        font-size: 1.3em !important;
    }
    
    .h4 {
        font-size: 1.2rem;
    }
    
    .h6 {
        font-size: 0.9rem;
    }
    
    .modal-dialog {
        margin: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 0.8rem 1rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .option-button {
        min-height: 48px;
        padding: 1rem;
    }
    
    .btn {
        min-height: 48px;
        padding: 0.8rem 1.2rem;
    }
    
    .option-button:hover:not(:disabled) {
        transform: none;
        box-shadow: none;
    }
    
    .btn:hover {
        transform: none;
    }
}

/* Small screen optimizations */
@media (max-width: 400px) {
    .container {
        padding-left: 5px;
        padding-right: 5px;
    }
    
    .card {
        border-radius: 10px;
    }
    
    .card-body {
        padding: 0.8rem;
    }
    
    .option-button {
        padding: 0.7rem;
        min-height: 50px;
        font-size: 0.9rem;
    }
    
    .option-letter {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
        margin-right: 0.7rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    header, footer, .btn, #answer-feedback {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Accessibility */
.option-button:focus {
    outline: 3px solid var(--railway-blue);
    outline-offset: 2px;
}

.btn:focus {
    outline: 3px solid var(--railway-blue);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .option-button {
        border-width: 3px;
    }
    
    .card {
        border: 2px solid var(--railway-dark);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
