/* ==========================================================================
   GEOCACHING QUIZ 2.0 - MASTER STYLESHEET (FRONTEND & ADMIN)
   ========================================================================== */

/* --- 1. GLOBAL GRUNDSTIL --- */
body {
    background-image: url(media/gc.jpg);
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    background-color: #121212; /* Fallback */
    margin: 0;
    padding: 20px;
    color: white;
    font-family: "Trebuchet MS", Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    box-sizing: border-box;
}

.container, .admin-container {
    width: 100%;
    max-width: 1000px;
    margin: 20px auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-sizing: border-box;
}

.card, .admin-container, .login-wrapper {
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #02874d;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.6);
    box-sizing: border-box;
    width: 100%;
}

.login-wrapper {
    max-width: 400px;
    margin: 80px auto;
}

/* --- 2. TYPOGRAFI & FÄRGER --- */
h1 {
    text-align: center;
    color: #02b668; 
    font-size: 2.2em;
    font-weight: 900;
    text-transform: uppercase; 
    letter-spacing: 1px; 
    text-shadow: 2px 2px 0px #000, -1px -1px 0px #000, 1px -1px 0px #000, -1px 1px 0px #000, 0px 4px 10px rgba(0, 0, 0, 0.9);
    margin: 10px 0 20px 0;
}

h2, h3 { 
    color: #02874d; 
    margin-top: 0; 
}

/* --- 3. FORMULÄR, FÄLT OCH KNAPPAR --- */
input[type="text"], input[type="password"], input[type="number"], textarea, select {
    width: 100%;
    padding: 12px;
    border: 1px solid #02874d;
    border-radius: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 16px;
    box-sizing: border-box;
    font-family: inherit;
}

input[type="radio"], input[type="checkbox"] {
    transform: scale(1.3);
    accent-color: #02874d;
    cursor: pointer;
}

.btn {
    background: #02874d;
    color: black;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-sizing: border-box;
    transition: background 0.2s, transform 0.1s;
}

.btn:hover { background: #026632; color: white; }
.btn:active { transform: scale(0.98); }

.btn-danger { background: #d9534f; color: white; }
.btn-danger:hover { background: #b52b27; }
.btn-secondary { background: #444; color: white; }
.btn-secondary:hover { background: #222; }

.password-container { position: relative; width: 100%; }
.password-container input { padding-right: 40px !important; }
.toggle-password-eye { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; color: #02874d; font-size: 18px; }

/* --- 4. ALERTS & NOTIFIKATIONER --- */
.alert {
    background: rgba(2, 135, 77, 0.4);
    color: #fff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 5px solid #02874d;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    word-break: break-word;
}
.alert-danger { background: rgba(217, 83, 79, 0.4); border-left: 5px solid #d9534f; }
.alert-deleted {
    background-color: rgba(217, 83, 79, 0.15);
    border: 1px solid #d9534f;
    color: #ff6b66;
    border-left: 5px solid #d9534f;
}
.undo-link { color: #02c46e; text-decoration: underline; font-weight: bold; cursor: pointer; margin-left: 15px; }
.undo-link:hover { color: #02f088; }

/* --- 5. TABELLER --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: rgba(0,0,0,0.5);
    border-radius: 10px;
    overflow: hidden;
}
th, td {
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: left;
    vertical-align: middle;
}
th { background-color: #02874d; color: black; }
tr:hover { background: rgba(255,255,255,0.05); }

.table-wrapper {
    overflow-x: auto;
    width: 100%;
    border-radius: 10px;
}

/* --- 6. ADMIN-SPECIFIKA KOMPONENTER (NY FLIKDESIGN) --- */
/* Huvudmenyn (Toppflikar) */
.admin-main-tabs {
    display: flex;
    border-bottom: 2px solid #02874d;
    margin-bottom: 20px;
    gap: 5px;
    flex-wrap: wrap;
}
.admin-main-tabs a {
    padding: 12px 20px;
    background: rgba(0,0,0,0.5);
    color: #ccc;
    text-decoration: none;
    font-weight: bold;
    border-radius: 10px 10px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    transition: all 0.2s;
}
.admin-main-tabs a:hover {
    background: rgba(2, 135, 77, 0.2);
    color: white;
}
.admin-main-tabs a.active {
    background: #02874d;
    color: black;
    border-color: #02874d;
}
.admin-main-tabs a.tab-right {
    margin-left: auto;
    background: #444;
    color: white;
}
.admin-main-tabs a.tab-right:hover {
    background: #222;
}
.admin-main-tabs a.tab-danger {
    margin-left: 5px;
    background: #d9534f;
    color: white;
}
.admin-main-tabs a.tab-danger:hover { background: #b52b27; }

/* Underflikar i Dashboard */
.admin-sub-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}
.sub-tab-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid #333;
    color: #aaa;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    flex: 1;
    min-width: 150px;
    text-align: center;
}
.sub-tab-btn:hover {
    border-color: #02874d;
    color: white;
}
.sub-tab-btn.active {
    background: rgba(2, 135, 77, 0.15);
    border-color: #02c46e;
    color: #02c46e;
    box-shadow: 0 0 10px rgba(2, 196, 110, 0.2);
}
.sub-tab-content {
    display: none;
    animation: fadeIn 0.3s;
}
.sub-tab-content.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Statiska paneler inuti flikarna */
.panel-header {
    background-color: #02874d;
    padding: 12px 20px;
    border-radius: 10px 10px 0 0;
    color: black;
    font-size: 1.2em;
    margin: 25px 0 0 0;
    font-weight: bold;
}
.panel-content {
    background: rgba(255,255,255,0.02);
    padding: 20px;
    border-radius: 0 0 10px 10px;
    border: 1px solid #02874d;
    border-top: none;
}

/* Accordion (Används bara i frågor.php) */
.section-toggle-header {
    background-color: #02874d; padding: 15px 20px; border-radius: 10px; color: black; font-size: 1.2em; margin-top: 20px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; user-select: none; font-weight: bold; transition: background 0.3s;
}

.bulk-actions-bar {
    background: rgba(2, 135, 77, 0.1);
    border: 1px solid rgba(2, 135, 77, 0.3);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.badge { display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: bold; vertical-align: middle; margin-left: 10px;}
.badge-mc { background-color: #025787; color: white; border: 1px solid #047bbd; }
.badge-em { background-color: #875702; color: white; border: 1px solid #bf7d04; }

/* --- 7. FRONTEND-SPECIFIKA KOMPONENTER --- */
.quiz-question-image {
    display: block;
    max-width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    margin: 15px auto;
    border-radius: 10px;
    border: 1px solid #02874d;
    box-sizing: border-box;
}

#quiz-container label {
    display: block;
    margin-bottom: 12px;
    font-size: 16px;
    cursor: pointer;
    padding: 8px 10px;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    border: 1px solid transparent;
    transition: background 0.2s;
}
#quiz-container label:hover { background: rgba(255,255,255,0.08); }
#quiz-container input[type="radio"] { margin-right: 12px; }

.changelog-box {
    background: rgba(0,0,0,0.85); 
    border: 1px solid rgba(2, 135, 77, 0.5); 
    border-radius: 12px; 
    padding: 20px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    box-sizing: border-box;
    z-index: 10;
}
@media (min-width: 1300px) { .changelog-box { position: fixed; left: 30px; top: 150px; width: 300px; margin: 0; } }
@media (max-width: 1299px) { .changelog-box { position: relative; width: 100%; max-width: 100%; margin: 0 0 30px 0; } }
#changelog-header:hover { opacity: 0.8; }

/* --- 8. MODALER OCH POPUPS --- */
#popup, #custom-alert, .edit-modal {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: none; justify-content: center; align-items: center;
    z-index: 99999; padding: 15px; box-sizing: border-box;
}

.popup-content, #custom-alert-box, .edit-modal-content {
    background: #111; border: 2px solid #02874d; padding: 30px; border-radius: 15px;
    text-align: center; max-width: 500px; width: 100%; max-height: 90vh; overflow-y: auto; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.8); box-sizing: border-box;
}

.edit-modal-content { max-width: 700px; text-align: left; }
.hidden { display: none !important; }

/* --- 9. RESPONSIV MAGI (MOBIL OCH SURFPLATTA) --- */
@media (max-width: 768px) {
    body { padding: 10px; }
    .container, .admin-container { margin: 10px auto; gap: 15px; }
    .card, .admin-container, .login-wrapper { padding: 20px; border-radius: 12px; }
    h1 { font-size: 1.8em; margin-bottom: 15px; }
    
    .btn { width: 100%; padding: 15px; font-size: 16px; margin-bottom: 5px; }
    
    .admin-main-tabs { border-bottom: none; }
    .admin-main-tabs a { width: 100%; text-align: center; border-radius: 8px; margin-bottom: 5px; border-bottom: 1px solid #333; }
    .admin-main-tabs a.tab-right, .admin-main-tabs a.tab-danger { margin-left: 0; }
    
    table { display: block; overflow-x: auto; white-space: nowrap; width: 100%; border: none; }
    .form-group, .form-inline { flex-direction: column; align-items: stretch !important; }
    
    #quiz-top-bar { flex-direction: column-reverse; gap: 15px; }
    .desktop-spacer { display: none; }
    #timer-display { width: 100%; box-sizing: border-box; padding: 15px; font-size: 24px; }
    
    .bulk-actions-bar { flex-direction: column; align-items: stretch; }
    .bulk-actions-bar .btn { margin-left: 0 !important; margin-top: 5px; }
    
    .popup-content, #custom-alert-box, .edit-modal-content { padding: 20px; }
    
    #quiz-navigation, #scoreboard-navigation { flex-direction: column; gap: 15px; }
    #page-indicator, #sb-page-indicator { order: -1; margin-bottom: 5px; } 
}