/* ==========================================================================
   Giftli — feuille de style commune
   Source unique du langage visuel (couleurs, cartes, boutons, formulaires,
   navigation, footer/CGU). Les pages ne doivent plus redéfinir ces styles :
   elles utilisent ces classes et n'ajoutent que leur mise en page propre.
   ========================================================================== */

:root {
    --primary-color: #fdf5ee;
    --accent-color: #ff4d6d;
    --accent-color-dark: #e13456;
    --accent-blue: #1f9490;
    --accent-blue-light: #e9dcc9;
    --accent-tint: #ffedf0;
    --accent-blue-tint: #e0f5f3;
    --gold-color: #f0a020;
    --gold-dark: #c9790f;
    --gold-tint: #fef1dc;
    --pink-color: #ff6f9c;
    --pink-dark: #e04a7c;
    --pink-tint: #ffe9f1;
    --text-color: #4a3f41;
    --heading-color: #201a1c;
    --hover-color: #ffd9c2;
    --shadow-color: rgba(255, 77, 109, 0.14);
    --shadow-blue: rgba(31, 148, 144, 0.14);
    --admin-red: #ff6b6b;
    --danger-color: #d9363e;
    --danger-bg: rgba(217, 54, 62, 0.08);
    --success-color: #1a9c5c;
    --success-bg: rgba(26, 156, 92, 0.08);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 14px;
    --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Reset & base ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

html {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    background: var(--primary-color);
    min-height: 100vh;
    padding: 2rem;
    color: var(--text-color);
    position: relative;
    overflow-x: hidden;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Conteneur étroit centré, pour les formulaires (login/register/etc.) */
.container-narrow {
    max-width: 480px;
    margin: 4vh auto;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    background: #fffdfb;
    border: 1px solid var(--accent-blue-light);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px var(--shadow-color);
    animation: fadeIn 0.4s ease-out;
}

/* ---------- Typographie ---------- */
h1 {
    text-align: center;
    color: var(--heading-color);
    margin-bottom: 2rem;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    animation: fadeIn 0.6s ease-in;
}

h1.underline {
    position: relative;
    padding-bottom: 1rem;
}

h1.underline::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-blue));
}

h2 {
    color: var(--heading-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

h3 {
    color: var(--heading-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--accent-color);
}

/* ---------- Logo ---------- */
.Giftli-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--heading-color);
    vertical-align: middle;
}

.Giftli-logo::before {
    content: '';
    width: 0.5em;
    height: 0.5em;
    border-radius: 30% 70% 65% 35% / 55% 40% 60% 45%;
    background: var(--accent-color);
    flex-shrink: 0;
}

.Giftli-logo::after {
    content: 'Giftli';
}

.logo-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.logo-header .Giftli-logo {
    font-size: 1.3rem;
}

/* ---------- Cartes ---------- */
.card {
    background: #fffdfb;
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: 0 1px 3px var(--shadow-color);
    border: 1px solid var(--accent-blue-light);
}

.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px var(--shadow-blue);
}

.card h3 {
    position: relative;
    padding-bottom: 0.5rem;
}

.card h3.centered {
    text-align: center;
}

.card h3.centered::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-blue));
}

.card ul {
    list-style: none;
}

.card li {
    margin: 0.8rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.card li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-blue);
}

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin: 0 0 1rem;
    border-radius: var(--radius-md);
}

.feature-icon svg {
    width: 24px;
    height: 24px;
}

.chip-coral {
    background: var(--accent-tint);
    color: var(--accent-color-dark);
}

.chip-gold {
    background: var(--gold-tint);
    color: var(--gold-dark);
}

.chip-teal {
    background: var(--accent-blue-tint);
    color: var(--accent-blue);
}

.chip-pink {
    background: var(--pink-tint);
    color: var(--pink-dark);
}

/* ---------- Boutons ---------- */
.btn {
    display: inline-block;
    text-decoration: none;
    text-align: center;
    padding: 0.9rem 2rem;
    border-radius: var(--radius-pill);
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font-main);
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease;
    box-shadow: 0 1px 2px var(--shadow-color);
    color: var(--heading-color);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-blue);
    color: var(--heading-color);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-primary {
    background: var(--accent-color);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--accent-color-dark);
    color: #ffffff;
}

.btn-secondary {
    background: #fffdfb;
    color: var(--text-color);
    border: 1.5px solid var(--accent-blue-light);
}

.btn-secondary:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    color: white;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* ---------- Formulaires ---------- */
form .form-group {
    margin: 1.4rem 0;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: var(--text-color);
}

input,
select,
textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--accent-blue-light);
    border-radius: var(--radius-sm);
    background: #fffdfb;
    color: var(--text-color);
    font-size: 1rem;
    font-family: var(--font-main);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--shadow-blue);
}

.error-message {
    background: var(--danger-bg);
    border-left: 4px solid var(--danger-color);
    color: var(--danger-color);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin: 1rem 0;
}

.success-message {
    background: var(--success-bg);
    border-left: 4px solid var(--success-color);
    color: var(--success-color);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin: 1rem 0;
}

.form-link {
    display: block;
    text-align: center;
    margin-top: 1.5rem;
    color: var(--accent-blue);
    font-weight: 700;
}

/* ---------- Checklist de mot de passe (register.php, verify.php) ---------- */
.password-rules {
    margin: 1rem 0;
    padding: 1rem;
    background: #fffdfb;
    border-radius: var(--radius-sm);
    border: 1px solid var(--accent-blue-light);
}

.password-rules ul {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
}

.password-rules li {
    margin: 0.3rem 0;
}

.password-validation {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-color);
}

.password-validation .rule {
    padding: 0.2rem 0;
    position: relative;
    padding-left: 1.5rem;
}

.password-validation .rule::before {
    content: '❌';
    position: absolute;
    left: 0;
}

.password-validation .rule.valid::before {
    content: '✅';
}

/* ---------- Captcha (case à cocher auto-hébergée) ---------- */
.captcha-widget {
    margin: 1rem 0;
}

.captcha-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1.5px solid var(--accent-blue-light);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    background: #fffdfb;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.captcha-box.captcha-verified {
    border-color: var(--success-color);
    background: var(--success-bg);
}

.captcha-box.captcha-error {
    border-color: var(--danger-color);
}

.captcha-checkbox-area {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    user-select: none;
}

.captcha-check-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    flex-shrink: 0;
}

.captcha-icon-checked {
    color: var(--success-color);
}

.captcha-label {
    font-size: 0.95rem;
    color: var(--text-color);
}

.captcha-brand {
    color: var(--accent-blue);
    opacity: 0.6;
    flex-shrink: 0;
}

.captcha-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--accent-blue-light);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.captcha-error-msg {
    margin-top: 0.5rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- Navigation (app connectée) ---------- */
nav.app-nav {
    background: #fffdfb;
    border-radius: var(--radius-lg);
    padding: 0.6rem;
    box-shadow: 0 1px 3px var(--shadow-color);
    margin-bottom: 2rem;
    border: 1px solid var(--accent-blue-light);
    position: relative;
    overflow: hidden;
}

nav.app-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-color), var(--accent-blue));
}

nav.app-nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.3rem;
}

nav.app-nav ul li a {
    text-decoration: none;
    color: var(--text-color);
    padding: 0.65rem 1.1rem;
    border-radius: var(--radius-md);
    background: transparent;
    transition: background-color 0.15s ease, color 0.15s ease;
    display: inline-block;
    font-weight: 600;
}

nav.app-nav ul li a:hover {
    background: var(--primary-color);
    color: var(--accent-color-dark);
}

.notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--accent-color);
    color: #ffffff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    margin-left: 8px;
    box-shadow: 0 2px 4px rgba(32, 26, 28, 0.15);
}

.notification-link.has-notifications {
    background: var(--accent-color) !important;
    color: white !important;
}

/* ---------- En-tête avec titre + menu profil ---------- */
.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    margin-bottom: 0;
    text-align: left;
}

/* ---------- Menu profil ---------- */
.profile-menu-container {
    position: relative;
    flex-shrink: 0;
}

.profile-button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #fffdfb;
    border: 2px solid var(--accent-blue);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
}

.profile-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow-blue);
}

.profile-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.profile-icon {
    width: 24px;
    height: 24px;
    color: var(--accent-blue);
}

.profile-menu {
    position: absolute;
    top: 60px;
    right: 0;
    background: #fffdfb;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px var(--shadow-color);
    padding: 0.5rem;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.profile-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-menu-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s ease;
}

.profile-menu-item:hover {
    background: var(--primary-color);
}

.profile-menu-item svg {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    color: var(--accent-blue);
}

/* ---------- Footer & modal CGU ---------- */
footer {
    text-align: center;
    margin-top: 3rem;
    padding: 1rem;
}

.cgu-button {
    background: transparent;
    border: none;
    color: var(--text-color);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.3s ease;
    font-size: 1rem;
}

.cgu-button:hover {
    color: var(--accent-color);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(20, 16, 17, 0.5);
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.modal-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    height: 80vh;
    margin: 10vh auto;
    background: #fffdfb;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 48px rgba(32, 26, 28, 0.2);
    overflow: hidden;
}

.modal-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #fffdfb;
    border: 1px solid var(--accent-blue-light);
    font-size: 1.5rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.close-button:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

/* ---------- Bloc admin (pages archives/admin) ---------- */
.admin-header {
    background: var(--heading-color);
    color: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-header h1 {
    color: white;
    text-align: left;
    margin-bottom: 0;
    animation: none;
    font-size: 1.8rem;
}

.action-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    display: inline-block;
    background: var(--accent-color);
    color: white;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

/* ---------- Grilles utilitaires ---------- */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.layout-main-side {
    max-width: 1200px;
    margin: 0 auto 2rem;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .container-narrow {
        margin: 2vh auto;
        padding: 1.5rem;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .layout-main-side {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    h1 {
        font-size: 1.75rem;
    }

    .dashboard-header {
        flex-wrap: wrap;
    }

    .modal-container {
        width: 95%;
        height: 90vh;
        margin: 5vh auto;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.75rem;
    }
}
