/**
 * Decoy Certification Exam Styles
 * Version 1.1.0
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

.decoy-exam,
.decoy-admin {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    color: #333;
    line-height: 1.5;
}

.exam-screen,
.admin-screen {
    display: none;
}

.exam-screen.active,
.admin-screen.active {
    display: block;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.exam-card,
.admin-card {
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 30px;
    margin-bottom: 20px;
}

.exam-card {
    max-width: 500px;
    margin: 40px auto;
}

.exam-card h2,
.admin-card h2,
.admin-card h3 {
    margin: 0 0 20px;
    font-size: 1.5rem;
    color: #1a1a1a;
}

.admin-card h3 {
    font-size: 1.2rem;
    margin-top: 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    margin: 0;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
    background: #fff;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #2c3e50;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-hint {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
}

.inline-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form input {
    padding: 10px 12px;
    border: 2px solid #ddd;
    font-size: 0.95rem;
}

.inline-form input:focus {
    outline: none;
    border-color: #2c3e50;
}

.answer-row {
    display: flex;
    gap: 15px;
    align-items: center;
}

.answer-row input[type="text"] {
    flex: 1;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    font-weight: normal;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    width: auto;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: #e9ecef;
    color: #333;
}

.btn:hover {
    background: #dee2e6;
}

.btn-primary {
    background: #2c3e50;
    color: #fff;
}

.btn-primary:hover {
    background: #1a252f;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.btn-submit {
    font-size: 1.1rem;
    padding: 14px 28px;
    width: 100%;
}

/* ==========================================================================
   Notices & Messages
   ========================================================================== */

.exam-info {
    color: #555;
    line-height: 1.6;
    margin-bottom: 20px;
    text-align: center;
}

.exam-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 15px;
    margin-bottom: 25px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.exam-notice.warning {
    background: #f8d7da;
    border-color: #dc3545;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 15px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* ==========================================================================
   Exam Header & Timer
   ========================================================================== */

.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2c3e50;
    color: #fff;
    padding: 15px 25px;
    margin-bottom: 25px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.exam-timer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timer-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.timer-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.timer-value.warning {
    color: #ffc107;
    animation: pulse 1s infinite;
}

.timer-value.danger {
    color: #ff6b6b;
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.exam-progress {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* ==========================================================================
   Questions
   ========================================================================== */

.question-block {
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 25px;
    margin-bottom: 20px;
    border-left: 4px solid transparent;
    transition: border-color 0.2s;
}

.question-block.answered {
    border-left-color: #28a745;
}

.question-number {
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.question-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 20px;
    line-height: 1.5;
}

.answer-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.answer-option {
    position: relative;
}

.answer-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.answer-option label {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    cursor: pointer;
    transition: all 0.2s;
}

.answer-option label:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.answer-option input:checked + label {
    background: #e8f4fd;
    border-color: #2c3e50;
}

.answer-key {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #dee2e6;
    font-weight: 600;
    font-size: 0.85rem;
    margin-right: 12px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.answer-option input:checked + label .answer-key {
    background: #2c3e50;
    color: #fff;
}

.answer-text {
    line-height: 1.5;
    padding-top: 3px;
}

/* ==========================================================================
   Exam Footer
   ========================================================================== */

.exam-footer {
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 25px;
    margin-top: 30px;
}

.submit-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
}

.submit-warning input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex-shrink: 0;
}

.submit-warning label {
    font-size: 0.95rem;
    color: #555;
    cursor: pointer;
}

/* ==========================================================================
   Results
   ========================================================================== */

.results-card {
    text-align: center;
    max-width: 450px;
}

.results-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

.results-icon.passed {
    background: #d4edda;
}

.results-icon.failed {
    background: #f8d7da;
}

.results-icon.neutral {
    background: #e9ecef;
}

.results-score {
    margin: 30px 0;
}

.score-main {
    font-size: 4rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1;
}

.score-percent {
    font-size: 2rem;
    color: #666;
}

.score-detail {
    font-size: 1.1rem;
    color: #666;
    margin-top: 10px;
}

.pass-fail-badge {
    display: inline-block;
    padding: 10px 30px;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 20px 0;
}

.pass-fail-badge.passed {
    background: #d4edda;
    color: #155724;
}

.pass-fail-badge.failed {
    background: #f8d7da;
    color: #721c24;
}

.results-info {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: 20px;
}

/* ==========================================================================
   Admin Tabs
   ========================================================================== */

.admin-tabs {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin-bottom: 25px;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: none;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #333;
}

.tab-btn.active {
    color: #2c3e50;
    border-bottom-color: #2c3e50;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==========================================================================
   Data Tables
   ========================================================================== */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    font-weight: 600;
    color: #666;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8f9fa;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.data-table code {
    background: #e9ecef;
    padding: 3px 8px;
    font-size: 0.9rem;
}

.status-available {
    color: #28a745;
    font-weight: 600;
}

.status-used {
    color: #999;
}

/* ==========================================================================
   Badges & Filters
   ========================================================================== */

.badge {
    display: inline-block;
    background: #e9ecef;
    padding: 2px 10px;
    font-size: 0.85rem;
    font-weight: normal;
    margin-left: 10px;
}

.filter-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.filter-row label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: #fff;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #ddd;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-content form {
    padding: 25px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    margin-top: 20px;
}

.modal-footer .btn-danger {
    margin-right: auto;
}

/* ==========================================================================
   Toast
   ========================================================================== */

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    font-weight: 600;
    z-index: 2000;
    max-width: 90%;
}

.toast.success {
    background: #d4edda;
    color: #155724;
}

.toast.error {
    background: #f8d7da;
    color: #721c24;
}

/* ==========================================================================
   Questions Accordion
   ========================================================================== */

.questions-accordion {
    border: 1px solid #ddd;
}

.question-accordion-item {
    border-bottom: 1px solid #eee;
}

.question-accordion-item:last-child {
    border-bottom: none;
}

.question-accordion-header {
    display: flex;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    background: #f8f9fa;
    transition: background 0.2s;
    gap: 10px;
}

.question-accordion-header:hover {
    background: #e9ecef;
}

.question-number {
    font-weight: 600;
    color: #666;
    min-width: 30px;
}

.question-preview {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.question-status {
    font-size: 0.8rem;
    padding: 2px 8px;
}

.accordion-toggle {
    color: #999;
    transition: transform 0.2s;
}

.question-accordion-item.open .accordion-toggle {
    transform: rotate(180deg);
}

.question-accordion-body {
    display: none;
    padding: 20px;
    background: #fff;
    border-top: 1px solid #eee;
}

.question-accordion-item.open .question-accordion-body {
    display: block;
}

.question-full-text {
    font-size: 1.05rem;
    margin-bottom: 15px;
    line-height: 1.5;
}

.answers-preview {
    margin-bottom: 15px;
}

.answer-preview {
    padding: 10px 15px;
    margin: 5px 0;
    background: #f8f9fa;
    border-left: 3px solid transparent;
}

.answer-preview.correct-answer {
    background: #d4edda;
    border-left-color: #28a745;
    font-weight: 500;
}

.question-actions {
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* ==========================================================================
   Decoy Directory
   ========================================================================== */

.decoy-directory {
    width: 100%;
}

.directory-loading {
    text-align: center;
    padding: 50px;
    color: #666;
}

/* Decoy List View */
.decoy-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.decoy-card {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    gap: 20px;
    padding: 20px;
    border: 1px solid #ddd;
    background: #fff;
    align-items: center;
}

.decoy-photo img {
    width: 100px;
    height: 100px;
    object-fit: cover;
}

.decoy-photo .no-photo {
    width: 100px;
    height: 100px;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

.decoy-name {
    margin: 0 0 5px;
    font-size: 1.3rem;
}

.decoy-location {
    color: #666;
    margin-bottom: 10px;
}

.decoy-certification {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.decoy-level {
    background: #2c3e50;
    color: #fff;
    padding: 4px 12px;
    font-weight: 600;
    font-size: 0.9rem;
}

.decoy-cert-date {
    color: #666;
    font-size: 0.9rem;
}

.decoy-contact {
    text-align: right;
}

.contact-item {
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.contact-label {
    color: #666;
}

/* Map View */
#directory-map-view {
    width: 100%;
    position: relative;
}

.reset-map-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    padding: 8px 14px;
    background: #fff;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.reset-map-btn:hover {
    background: #f4f4f4;
}

.decoy-map-full {
    width: 100%;
    height: 600px;
    border: 1px solid #ddd;
}

.map-popup {
    min-width: 150px;
}

.popup-level {
    background: #2c3e50;
    color: #fff;
    padding: 2px 6px;
    font-size: 0.8rem;
}

.popup-contact {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    font-size: 0.85rem;
}

.popup-contact div {
    margin: 3px 0;
}

.popup-contact a {
    color: #2c3e50;
}

/* ==========================================================================
   Decoy Management (Committee Dashboard) - Single Column
   ========================================================================== */

.decoys-list-single {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px;
}

.decoy-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border: 1px solid #ddd;
    background: #fff;
    width: 100%;
}

.decoy-row-photo img {
    width: 45px;
    height: 45px;
    object-fit: cover;
}

.decoy-row-photo .no-photo-small {
    width: 45px;
    height: 45px;
    background: #e9ecef;
}

.no-photo-small {
    width: 50px;
    height: 50px;
    background: #e9ecef;
}

.decoy-row-info {
    flex: 1;
    min-width: 150px;
}

.decoy-row-info strong {
    display: block;
}

.decoy-row-location {
    font-size: 0.85rem;
    color: #666;
}

.decoy-row-cert {
    min-width: 130px;
    text-align: center;
}

.decoy-row-cert strong {
    display: block;
}

.decoy-row-cert span {
    font-size: 0.85rem;
    color: #666;
}

.decoy-row-badges {
    min-width: 200px;
}

.decoy-row-actions {
    min-width: 80px;
    text-align: right;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Decoy Edit Modal */
.decoy-edit-header {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.decoy-edit-photo {
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.decoy-edit-header h4 {
    margin: 0 0 5px;
}

.decoy-edit-header p {
    margin: 0;
    color: #666;
}

.search-filter-row {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-filter-row .search-input {
    flex: 1;
    min-width: 200px;
}

.search-input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    font-size: 1rem;
    width: 100%;
    max-width: 300px;
}

.level-filter {
    padding: 10px 15px;
    border: 1px solid #ddd;
    font-size: 1rem;
    background: #fff;
    min-width: 120px;
}

.directory-filters {
    display: flex;
    gap: 15px;
    flex: 1;
    justify-content: flex-end;
}

.directory-filters .search-input {
    max-width: 250px;
}

.sidebar-cert {
    font-size: 0.8rem;
    color: #888;
    margin-top: 2px;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: #666;
}

/* ==========================================================================
   Utility
   ========================================================================== */

.loading,
.empty-message {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 30px;
}

hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 25px 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 600px) {
    .decoy-exam,
    .decoy-admin {
        padding: 10px;
    }
    
    .exam-card,
    .admin-card {
        padding: 20px 15px;
        margin: 20px auto;
    }
    
    .exam-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .question-block {
        padding: 20px 15px;
    }
    
    .score-main {
        font-size: 3rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        text-align: center;
        padding: 10px 15px;
    }
    
    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .inline-form input {
        width: 100% !important;
    }
    
    .data-table {
        font-size: 0.9rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
    
    .answer-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    /* Directory responsive */
    .decoy-card {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .decoy-photo {
        justify-self: center;
    }
    
    .decoy-contact {
        text-align: center;
    }
    
    .decoy-map-full {
        height: 400px;
    }
    
    /* Admin decoy list responsive */
    .decoy-row {
        flex-wrap: wrap;
    }
    
    .decoy-row-info {
        flex: 1 1 100%;
        order: 1;
    }
    
    .decoy-row-photo {
        order: 0;
    }
    
    .decoy-row-cert {
        order: 2;
        text-align: left;
    }
    
    .decoy-row-badges {
        order: 3;
        min-width: auto;
    }
    
    .decoy-row-actions {
        order: 4;
    }
}
