:root {
    --bg-color: #0b0d17;
    --card-bg: rgba(23, 27, 44, 0.45);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(99, 102, 241, 0.5);
    --text-primary: #f0f2f5;
    --text-secondary: #94a3b8;
    --accent-primary: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.25);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --blob-1: #4f46e5;
    --blob-2: #ec4899;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding: 4rem 1rem;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.5px;
}

/* Background Effects */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    filter: blur(120px);
    opacity: 0.7;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    animation: float 25s infinite ease-in-out alternate;
}

.blob1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--blob-1) 0%, transparent 60%);
}

.blob2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--blob-2) 0%, transparent 60%);
    animation-delay: -5s;
}

.blob-verify-1 {
    top: -20%;
    right: -10%;
    width: 70vw;
    height: 70vw;
    background: radial-gradient(circle, var(--success) 0%, transparent 65%);
    opacity: 0.4;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(8%, 12%) scale(1.15);
    }
}

/* Container */
.container {
    width: 100%;
    max-width: 640px;
    margin: auto;
    position: relative;
    z-index: 10;
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 3.5rem;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.animate-up {
    animation: fadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

header p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
}

/* Forms */
form {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.row {
    display: flex;
    gap: 1.25rem;
}

.half {
    flex: 1;
}

.third {
    flex: 1;
    min-width: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-left: 0.25rem;
}

.input-wrapper {
    position: relative;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
}

.input-wrapper::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 15px;
    padding: 1px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 1;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within::before {
    background: linear-gradient(180deg, var(--accent-primary) 0%, rgba(99, 102, 241, 0.1) 100%);
}

.input-wrapper:focus-within {
    box-shadow: 0 0 0 4px var(--accent-glow);
    background: rgba(0, 0, 0, 0.4);
}

input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 1rem 1.2rem;
    border-radius: 14px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    position: relative;
    z-index: 2;
}

input::placeholder {
    color: rgba(255, 255, 255, 0.15);
}

input[type="date"] {
    color: var(--text-primary);
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.2s;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 0.8;
}

/* Buttons */
.submit-btn {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
    color: white;
    border: none;
    padding: 1.1rem;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: 1.5rem;
    box-shadow: 0 12px 24px -10px var(--accent-primary), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 32px -10px var(--accent-primary), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.submit-btn:active {
    transform: translateY(0);
}

/* Result Area */
#resultArea {
    margin-top: 2.5rem;
    display: none;
    flex-direction: column;
    gap: 1rem;
}

#resultArea.visible {
    display: flex;
    animation: fadeUp 0.5s ease forwards;
}

.success-alert {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--success-bg);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
}

.success-icon {
    width: 24px;
    height: 24px;
    color: var(--success);
}

.success-alert p {
    color: #34d399;
    font-weight: 500;
    font-size: 0.95rem;
}

.verify-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.1rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 14px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.verify-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* Verification Page */
.verify-container {
    max-width: 540px;
    padding: 3rem;
}

.verify-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2.5rem;
    text-align: center;
    position: relative;
}

.badge {
    position: absolute;
    top: -10px;
    right: 0;
    background: var(--success-bg);
    color: var(--success);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.status-icon.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
    color: var(--success);
    border: 2px solid rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 40px rgba(16, 185, 129, 0.25);
}

.pulse {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.verify-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.data-card {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 20px;
    padding: 0.5rem 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.data-row:last-child {
    border-bottom: none;
}

.data-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.data-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.05rem;
    text-align: right;
}

.data-value.highlight {
    color: #fff;
    font-weight: 700;
}

.action-btn {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    padding: 1.1rem;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
}

/* Skeletons */
.skeleton {
    display: inline-block;
    height: 20px;
    width: 100px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

#val-matricule .skeleton {
    width: 140px;
}

#val-attestation .skeleton {
    width: 90px;
}

#val-nom .skeleton,
#val-prenom .skeleton {
    width: 120px;
}

#val-date_naissance .skeleton,
#val-date_ajour .skeleton {
    width: 110px;
}

#val-date_annulation .skeleton {
    width: 40px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 2rem 1.5rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .row {
        flex-direction: column;
        gap: 1.75rem;
    }

    .data-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .data-value {
        text-align: left;
    }
}

/* QR Code */
.qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #ffffff;
    padding: 1rem;
    border-radius: 16px;
    margin: 0 auto;
    width: fit-content;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.qr-container:hover {
    transform: scale(1.02);
}

.qr-container img,
.qr-container canvas {
    border-radius: 4px;
    display: block;
}

/* Download QR Button */
.download-qr-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: fit-content;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 20px -6px rgba(16, 185, 129, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.download-qr-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -6px rgba(16, 185, 129, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.download-qr-btn:active {
    transform: translateY(0);
}

/* Input + Generate button row */
.input-row {
    display: flex;
    gap: 0.6rem;
    align-items: stretch;
}

.gen-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 1rem;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s ease;
}

.gen-btn:hover {
    background: rgba(99, 102, 241, 0.28);
    border-color: rgba(99, 102, 241, 0.5);
    color: #c7d2fe;
}

/* ── Login Overlay ─────────────────────────────────────────────── */
#loginOverlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-logo {
    display: flex;
    justify-content: center;
    color: var(--accent-primary);
    margin-bottom: 0.25rem;
}

.login-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.login-sub {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: -0.5rem;
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    border-radius: 10px;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    text-align: center;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.login-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.login-field input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 0.85rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    width: 100%;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.login-field input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.pass-wrapper {
    position: relative;
}

.pass-wrapper input {
    padding-right: 3rem;
}

.toggle-pass {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.toggle-pass:hover {
    color: var(--text-primary);
}

.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 24px -8px var(--accent-primary), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -8px var(--accent-primary), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.hidden {
    display: none !important;
}
