:root {
    --otf-blue: #1565c0;
    --otf-blue-dark: #0d47a1;
    --otf-amber: #ffa000;
    --otf-bg: #f5f5f5;
    --otf-surface: #ffffff;
    --otf-text: #212121;
    --otf-secondary-text: #616161;
    --otf-error: #c62828;
    --otf-success: #2e7d32;
    --otf-radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--otf-bg);
    color: var(--otf-text);
}

/* ==========================================================================
   Navigation (public pages)
   ========================================================================== */

.site-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 24px;
    background-color: var(--otf-blue);
    color: white;
}

.nav-brand {
    font-size: 20px;
    font-weight: 700;
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 20px;
    font-size: 14px;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
}

.nav-links a.active,
.nav-links a:hover {
    border-bottom-color: var(--otf-amber);
}

.site-main {
    min-height: 70vh;
}

.site-footer {
    text-align: center;
    padding: 16px;
    color: var(--otf-secondary-text);
    font-size: 13px;
}

/* ==========================================================================
   Public pages (Home, general content)
   ========================================================================== */

.page-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 16px;
}

.page-container h1 {
    color: var(--otf-blue);
}

.lead {
    color: var(--otf-secondary-text);
    line-height: 1.6;
}

.card {
    background: var(--otf-surface);
    border-radius: var(--otf-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 20px;
    margin: 20px 0;
}

.home-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.button-link {
    padding: 12px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

.button-link.primary {
    background-color: var(--otf-blue);
    color: white;
}

.button-link.secondary {
    background-color: transparent;
    color: var(--otf-blue);
    border: 1px solid var(--otf-blue);
}

/* ==========================================================================
   Forms (Report Problem, Contact/Feedback)
   ========================================================================== */

.app-form {
    background: var(--otf-surface);
    border-radius: var(--otf-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.app-form label {
    margin-top: 14px;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
}

.app-form input,
.app-form select,
.app-form textarea {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
}

.app-form input:focus,
.app-form select:focus,
.app-form textarea:focus {
    outline: none;
    border-color: var(--otf-blue);
}

.app-form button[type="submit"] {
    margin-top: 24px;
    padding: 12px;
    background-color: var(--otf-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.app-form button[type="submit"]:hover {
    background-color: var(--otf-blue-dark);
}

.app-form button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.status-message {
    max-width: 720px;
    margin: 16px auto 0;
    padding: 12px 16px;
    background-color: #e3f2fd;
    color: var(--otf-blue-dark);
    border-radius: 6px;
}

/* ==========================================================================
   Media preview + pinch zoom (Report Problem)
   ========================================================================== */

.media-preview-container {
    margin-top: 16px;
    text-align: center;
}

.media-preview-zoom-wrapper {
    max-width: 100%;
    max-height: 320px;
    overflow: auto;
    touch-action: pinch-zoom;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.media-preview-zoomable {
    max-width: 100%;
    display: block;
    margin: 0 auto;
}

.remove-media-button {
    margin-top: 10px;
    background: none;
    border: 1px solid var(--otf-error);
    color: var(--otf-error);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
}

.hint {
    font-size: 12px;
    color: var(--otf-secondary-text);
    margin-top: 6px;
}

/* ==========================================================================
   WhatsApp confirmation dialog (Report Problem)
   ========================================================================== */

.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
}

/* Ensure the [hidden] attribute is respected — without this rule, the
   display:flex above overrides the browser's default hidden{display:none} */
.dialog-overlay[hidden] {
    display: none;
}

.dialog-box {
    background: var(--otf-surface);
    border-radius: var(--otf-radius);
    padding: 24px;
    max-width: 400px;
    width: 100%;
}

.dialog-box h3 {
    margin-top: 0;
}

.dialog-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

.dialog-primary {
    background-color: var(--otf-blue);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.dialog-secondary {
    background: none;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
}

.dialog-cancel {
    background: none;
    border: 1px solid var(--otf-error);
    color: var(--otf-error);
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
}

/* ==========================================================================
   Admin — Login
   ========================================================================== */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.auth-card {
    background: var(--otf-surface);
    border-radius: var(--otf-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 32px;
    width: 100%;
    max-width: 380px;
}

.auth-card h1 {
    margin: 0 0 4px;
    font-size: 24px;
    color: var(--otf-blue);
}

.subtitle {
    margin: 0 0 24px;
    color: var(--otf-secondary-text);
    font-size: 14px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--otf-blue);
}

button {
    width: 100%;
    padding: 12px;
    background-color: var(--otf-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    background-color: var(--otf-blue-dark);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error-message {
    margin-top: 16px;
    color: var(--otf-error);
    font-size: 14px;
    text-align: center;
}

/* ==========================================================================
   Admin — Dashboard
   ========================================================================== */

.dashboard-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.dashboard-header h1 {
    color: var(--otf-blue);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.logout-link {
    color: var(--otf-error);
    text-decoration: none;
    font-weight: 600;
}

.dashboard-note {
    color: var(--otf-secondary-text);
    margin-bottom: 24px;
}

.dashboard-card {
    background: var(--otf-surface);
    border-radius: var(--otf-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 20px;
    margin-bottom: 24px;
}

.dashboard-card h2 {
    margin-top: 0;
    font-size: 18px;
}

.dashboard-card code {
    background: #eeeeee;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.test-result {
    margin-top: 16px;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
}

.test-result.success {
    background-color: #e8f5e9;
    color: var(--otf-success);
}

.test-result.failure {
    background-color: #ffebee;
    color: var(--otf-error);
}

.exit-link {
    display: inline-block;
    color: var(--otf-blue);
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--otf-blue);
    padding: 10px 16px;
    border-radius: 6px;
}

.exit-link:hover {
    background-color: var(--otf-blue);
    color: white;
}

/* ==========================================================================
   PWA install banner
   ========================================================================== */

.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--otf-blue-dark);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    z-index: 2000;
    font-size: 14px;
}

.pwa-install-actions {
    display: flex;
    gap: 8px;
}

.pwa-install-actions button {
    width: auto;
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}

#pwaInstallButton {
    background-color: var(--otf-amber);
    color: #212121;
}

.pwa-dismiss {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
}
