/* ===============================
   GENERAL
================================ */
.rmt-exam {
    max-width: 1200px;
    margin: 20px auto;
    background: #ffffff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: Arial, sans-serif;
    position: relative;
}

/* ===============================
   QUESTION BOX - COMPACT LAYOUT
================================ */
.rmt-exam .q-box {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.rmt-exam .q-box p {
    color: #333;
    font-size: 16px;
    margin-bottom: 15px;
    font-weight: 600;
    line-height: 1.5;
}

/* ===============================
   OPTIONS - COMPACT INLINE STYLE
================================ */
.rmt-exam .q-box label {
    display: flex;
    align-items: center;
    margin: 8px 0;
    padding: 10px 12px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
}

.rmt-exam .q-box label:hover {
    background: #f0f7ff;
    border-color: #0073aa;
}

.rmt-exam .q-box input[type="radio"] {
    margin-right: 10px;
    flex-shrink: 0;
}

.rmt-exam .q-box label span {
    flex: 1;
}

/* Images in questions and options */
.q-box img {
    max-width: 100%;
    height: auto;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: block;
}

.q-box label img {
    max-width: 150px;
    margin: 5px 10px 5px 0;
    display: inline-block;
    vertical-align: middle;
}

.rmt-exam .q-box label:has(input[type="radio"]:checked) {
    background: #e3f2fd;
    border-color: #2196f3;
    font-weight: 600;
}

/* ===============================
   NAVIGATION BUTTONS - STICKY
================================ */
.rmt-navigation {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding: 15px 20px;
    background: #fff;
    border-radius: 8px;
    position: sticky;
    bottom: 0;
    z-index: 999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

/* Desktop: Show all buttons in a row */
@media (min-width: 769px) {
    .rmt-navigation {
        justify-content: flex-start;
    }
}

.rmt-nav-btn {
    padding: 12px 24px;
    font-size: 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.rmt-btn-prev,
.rmt-btn-next {
    background: #0073aa;
    color: #ffffff;
}

.rmt-btn-prev:hover,
.rmt-btn-next:hover {
    background: #005177;
}

.rmt-btn-prev:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.rmt-btn-mark {
    background: #ff9800;
    color: #fff;
}

.rmt-btn-mark:hover {
    background: #f57c00;
}

.rmt-btn-mark.rmt-marked-active {
    background: #4caf50;
}

.rmt-submit-btn {
    background: #d32f2f;
    color: #ffffff;
    padding: 12px 32px;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.rmt-submit-btn:hover {
    background: #b71c1c;
}

/* ===============================
   QUESTION PALETTE
================================ */
.rmt-palette {
    position: fixed;
    right: 20px;
    top: 80px;
    width: 280px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    transition: transform 0.3s;
}

.rmt-palette.rmt-palette-collapsed {
    transform: translateX(calc(100% + 20px));
}

.rmt-palette-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 15px;
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rmt-palette-header h3 {
    margin: 0;
    font-size: 16px;
}

.rmt-palette-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
}

.rmt-palette-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Mobile Palette Header */
.rmt-palette-mobile-header {
    display: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 15px;
    border-radius: 12px 12px 0 0;
    justify-content: space-between;
    align-items: center;
}

.rmt-palette-mobile-header h3 {
    margin: 0;
    font-size: 18px;
}

.rmt-palette-mobile-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
}

.rmt-palette-mobile-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Mobile Floating Toggle Button */
.rmt-palette-mobile-toggle {
    display: none;
    position: fixed;
    bottom: 120px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: #fff;
    border: none;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.3s;
}

.rmt-palette-mobile-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.rmt-palette-mobile-toggle.active {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.rmt-palette-legend {
    padding: 10px 15px;
    background: #f9f9f9;
    border-bottom: 1px solid #ddd;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rmt-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rmt-palette-grid {
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.rmt-palette-box {
    width: 40px;
    height: 40px;
    border: 2px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 14px;
}

.rmt-palette-box:hover {
    transform: scale(1.1);
}

.rmt-palette-box.rmt-current {
    background: #2196f3;
    color: #fff;
    border-color: #1976d2;
}

.rmt-palette-box.rmt-answered {
    background: #4caf50;
    color: #fff;
    border-color: #388e3c;
}

.rmt-palette-box.rmt-marked {
    background: #ff9800;
    color: #fff;
    border-color: #f57c00;
}

.rmt-palette-box.rmt-not-answered {
    background: #fff;
    border-color: #ddd;
}

/* ===============================
   TIMER (ALWAYS VISIBLE – CBT)
================================ */
#rmt-timer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #1e88e5;
    color: #ffffff;
    padding: 12px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    z-index: 99999;
    border-bottom: 2px solid #0d47a1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* LAST 60 SEC */
#rmt-timer.rmt-danger {
    background: #d32f2f;
    animation: pulse 1s infinite;
}

/* WARNING (5 min remaining) */
#rmt-timer.rmt-warning {
    background: #ff9800;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

/* ===============================
   FULLSCREEN BUTTON
================================ */
.rmt-fullscreen-btn {
    position: fixed;
    top: 10px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    z-index: 100000;
    transition: all 0.3s;
}

.rmt-fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* GAP FOR TIMER */
body {
    padding-top: 55px;
}

/* ===============================
   RESPONSIVE DESIGN
================================ */
@media (max-width: 768px) {
    .rmt-exam {
        padding: 15px 10px 100px 10px;
        margin: 10px;
    }

    .q-box {
        max-height: calc(100vh - 250px);
        padding: 15px;
    }

    .rmt-navigation {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        border-radius: 0;
        padding: 10px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        background: #fff;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 999;
    }

    .rmt-nav-btn {
        padding: 10px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    .rmt-btn-prev {
        grid-column: 1;
    }

    .rmt-btn-next {
        grid-column: 2;
    }

    .rmt-btn-mark {
        grid-column: 1 / 3;
        order: -1;
    }

    .rmt-submit-btn {
        grid-column: 1 / 3;
        padding: 12px 20px;
        font-size: 15px;
        font-weight: bold;
        display: block !important;
        /* Force show on mobile */
    }

    .rmt-palette {
        width: 100%;
        right: 0;
        left: 0;
        top: auto;
        bottom: 0;
        border-radius: 12px 12px 0 0;
        max-height: 60vh;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }

    .rmt-palette.rmt-palette-open {
        transform: translateY(0);
    }

    .rmt-palette-header {
        display: none;
    }

    .rmt-palette-mobile-header {
        display: flex;
    }

    .rmt-palette-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .rmt-palette-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    #rmt-timer {
        font-size: 16px;
        padding: 10px;
    }

    .rmt-exam {
        padding: 10px 5px 120px 5px;
    }

    .q-box {
        max-height: calc(100vh - 200px);
        padding: 12px;
    }

    .q-box p {
        font-size: 14px;
    }

    .rmt-exam .q-box label {
        padding: 8px 10px;
        font-size: 13px;
    }

    .rmt-navigation {
        padding: 8px;
        gap: 6px;
    }

    .rmt-nav-btn {
        padding: 8px 10px;
        font-size: 12px;
    }

    .rmt-submit-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .rmt-palette-mobile-toggle {
        bottom: 130px;
        width: 55px;
        height: 55px;
        font-size: 12px;
    }
}

/* ===============================
   PRINT STYLES
================================ */
@media print {

    .rmt-palette,
    .rmt-navigation,
    #rmt-timer,
    .rmt-fullscreen-btn {
        display: none !important;
    }
}