/* =========================
   Variables & Base
========================= */
:root {
    --primary-color: #dc2743;
    --bg-color: #f0f0f0;
    --surface-color: #ffffff;
    --border-color: #dbdbdb;
    --border-light: #efefef;
    --text-main: #262626;
    --text-secondary: #8e8e8e;

    --radius-sm: 5px;
    --radius-md: 8px;
    --radius-lg: 10px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --transition-fast: 0.2s ease;
}

/* =========================
   Global
========================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font: inherit; /* appliqué globalement, couvre aussi textarea */
    color: var(--text-main);
    background-color: var(--bg-color);
    line-height: 1.5;
}

/* =========================
   Header & Navigation
========================= */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    padding: 10px 0;
    text-align: center;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}

.header h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* =========================
   Main Layout
========================= */
.main-container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
}

/* =========================
   Flash Alerts
========================= */
.alert {
    width: 90%;
    max-width: 460px;
    margin: 10px auto 20px;
    padding: 15px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    animation: fadeIn 0.5s ease;
}

.alert-error {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
}

/* =========================
   Forms
========================= */
.post-form {
    margin-bottom: 25px;
    padding: 20px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

textarea {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    color: var(--text-main);
    border: none;
    outline: none;
    resize: vertical;
    background: transparent;
}

textarea::placeholder {
    color: var(--text-secondary);
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

.btn-publish {
    padding: 9px 20px;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    background: linear-gradient(45deg, #e6683c, #dc2743, #bc1888);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(220, 39, 67, 0.2);
    transition: all var(--transition-fast);
}

.btn-publish:hover {
    box-shadow: 0 6px 16px rgba(220, 39, 67, 0.35);
    filter: brightness(1.05);
}

.btn-publish:active {
    transform: scale(0.98);
}

/* =========================
   Post Cards
========================= */
.post-card {
    margin-bottom: 25px;
    overflow: hidden;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
}

.avatar {
    width: 32px;
    height: 32px;
    margin-right: 10px;
    background-color: #ddd;
    border-radius: 50%;
    flex-shrink: 0;
}

.username {
    font-size: 0.9rem;
    font-weight: 600;
}

.post-image {
    display: block;
    width: 100%;
    height: auto;
}

.post-content {
    padding: 12px;
    font-size: 0.95rem;
}

.post-date {
    padding: 0 12px 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* =========================
   Buttons / Misc
========================= */
#btn-edit-bio {
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

#btn-edit-bio:hover {
    color: white;
    background-color: var(--primary-color);
}

/* =========================
   Animations
========================= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================
   Responsive
========================= */
@media (max-width: 520px) {
    .main-container {
        padding: 12px;
    }

    .post-form,
    .post-card {
        border-radius: var(--radius-sm);
    }

    .header h1 {
        font-size: 1.2rem;
    }
}

/* =========================
   Authentification (Login/Register/Forgot)
========================= */
.auth-page-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    /* Cohérent avec la palette du header */
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 20px 15px;
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-card {
    background-color: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.auth-brand {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 5px;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0;
    margin-bottom: 30px;
}

.auth-form-group {
    position: relative;
    margin-bottom: 20px;
    text-align: left;
}

/* L'icône doit être APRÈS l'input dans le DOM pour que le sélecteur :focus ~ i fonctionne.
   Si ce n'est pas possible, utilisez JS ou forcez la couleur via :focus-within sur le parent. */
.auth-form-group:focus-within i {
    color: #dc2743;
}

.auth-form-group i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1rem;
    transition: color var(--transition-fast);
    pointer-events: none;
}

.auth-input {
    appearance: none;
    width: 100%;
    padding: 12px 12px 12px 42px;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-lg);
    background-color: #f9fafb;
    font-size: 0.95rem;
    color: var(--text-main);
    outline: none;
    transition: all var(--transition-fast);
}

.auth-input:focus {
    border-color: #dc2743;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(220, 39, 67, 0.15);
}

.btn-auth {
    width: 100%;
    padding: 14px;
    background: linear-gradient(45deg, #e6683c, #dc2743, #bc1888);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(220, 39, 67, 0.25);
    transition: all var(--transition-fast);
}

.btn-auth:hover {
    box-shadow: 0 6px 20px rgba(220, 39, 67, 0.4);
    filter: brightness(1.05);
}

.btn-auth:active {
    transform: scale(0.98);
}

.auth-footer-links {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid var(--border-light);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.btn-register-link {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 20px;
    border: 1px solid #dc2743;
    color: #dc2743;
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.btn-register-link:hover {
    background-color: rgba(220, 39, 67, 0.05);
    text-decoration: none;
}

.forgot-link-wrapper {
    text-align: right;
    margin-top: -10px;
    margin-bottom: 25px;
    font-size: 0.85rem;
}