/* =================================================================== */
/* == KHEDMA.MA - DV LOTTERY PHOTO TOOL DESIGN SYSTEM               == */
/* =================================================================== */

:root {
    --km-navy: #0d1527;
    --km-blue: #174288;
    --km-primary: #1d4ed8;
    --km-lime: #c7f000;
    --km-bg: #f8fafc;
    --km-card: #ffffff;
    --km-text: #0f172a;
    --km-muted: #64748b;
    --km-border: #e2e8f0;
    --km-success: #16a34a;
    --km-danger: #dc2626;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--km-bg);
    color: var(--km-text);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
}

/* --- Global Header --- */
.global-header {
    background: linear-gradient(135deg, var(--km-navy) 0%, #1e293b 100%);
    color: #ffffff;
    padding: 14px 24px;
    width: 100%;
    border-bottom: 3px solid var(--km-lime);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.header-container {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.header-brand-group {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.header-brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.header-brand-text h1 {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-brand-text h1 span.badge {
    background: var(--km-lime);
    color: #0b0b0b;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.header-brand-text p {
    font-size: 0.78rem;
    color: #94a3b8;
    margin: 2px 0 0;
}

/* --- Global Nav Links --- */
.global-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.global-nav a {
    color: #f1f5f9;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.global-nav a:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: var(--km-lime);
}

.global-nav a.active {
    background-color: var(--km-primary);
    color: #ffffff;
    font-weight: 700;
}

.nav-pill-official {
    background: rgba(199, 240, 0, 0.15) !important;
    border: 1px solid var(--km-lime) !important;
    color: var(--km-lime) !important;
}

/* --- Main Container --- */
.container {
    width: 100%;
    max-width: 1180px;
    margin: 28px auto;
    padding: 0 20px;
    flex-grow: 1;
}

/* --- Introduction Box --- */
.page-introduction {
    background: #ffffff;
    border: 1px solid var(--km-border);
    border-radius: 14px;
    padding: 28px;
    margin-bottom: 28px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    text-align: center;
}

.page-introduction h2 {
    font-size: 1.6rem;
    color: var(--km-navy);
    font-weight: 800;
    margin-bottom: 12px;
}

.page-introduction p {
    font-size: 1rem;
    color: var(--km-muted);
    max-width: 860px;
    margin: 0 auto 14px;
    line-height: 1.7;
}

/* --- Choice Cards --- */
.tool-choice {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 28px;
}

.tool-card {
    background: #ffffff;
    border: 1px solid var(--km-border);
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
    border-color: var(--km-primary);
}

.tool-card h3 {
    font-size: 1.25rem;
    color: var(--km-navy);
    font-weight: 800;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-card p.description {
    font-size: 0.94rem;
    color: var(--km-muted);
    margin-bottom: 20px;
    line-height: 1.6;
    flex-grow: 1;
}

/* --- Buttons --- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: var(--km-primary);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 8px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.button:hover {
    background-color: #1e40af;
    transform: translateY(-1px);
}

.button-secondary {
    background-color: #f1f5f9;
    color: #0f172a;
    border: 1px solid #cbd5e1;
}

.button-secondary:hover {
    background-color: #e2e8f0;
}

.button-success {
    background-color: var(--km-success);
    color: #ffffff;
}

.button-success:hover {
    background-color: #15803d;
}

/* --- Upload Containers --- */
.upload-container {
    background: #ffffff;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    padding: 40px 20px;
    text-align: center;
    margin: 20px 0;
    transition: border-color 0.2s ease;
}

.upload-container:hover {
    border-color: var(--km-primary);
}

/* --- Cropper Area --- */
#cropper-ui-container {
    position: relative;
    max-width: 640px;
    height: 480px;
    margin: 20px auto;
    background-color: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

#cropper-image-preview {
    max-width: 100%;
}

/* Position Markers */
.head-marker, .eye-marker {
    position: absolute;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    z-index: 12 !important;
}

.head-marker {
    width: 24px;
    height: 24px;
    background-color: rgba(239, 68, 68, 0.85);
    border: 2px solid #ffffff;
    box-shadow: 0 0 6px rgba(0,0,0,0.4);
}

.eye-marker {
    width: 18px;
    height: 18px;
    background-color: rgba(37, 99, 235, 0.85);
    border: 2px solid #ffffff;
    box-shadow: 0 0 6px rgba(0,0,0,0.4);
}

/* Validator Tool Layout */
.tool {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}

@media (max-width: 860px) {
    .tool {
        grid-template-columns: 1fr;
    }
}

#image-preview-container {
    position: relative;
    width: 100%;
    max-width: 440px;
    aspect-ratio: 1 / 1;
    margin: 0 auto 16px;
    background-color: #ffffff;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#image-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 6;
}

/* Checklist Results */
.results-area {
    background: #ffffff;
    border: 1px solid var(--km-border);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.04);
}

.results-area h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--km-navy);
    border-bottom: 2px solid var(--km-border);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.checklist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.checklist li {
    padding: 9px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.checklist li.pass {
    color: #15803d;
}

.checklist li.fail {
    color: #b91c1c;
    background-color: #fef2f2;
    border-radius: 6px;
    margin-bottom: 4px;
}

.hidden {
    display: none !important;
}

/* Global Footer */
.global-footer {
    background-color: var(--km-navy);
    color: #94a3b8;
    text-align: center;
    padding: 24px 20px;
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.global-footer a {
    color: var(--km-lime);
    text-decoration: none;
}