/* ============================================================
   StudioOnline - Charte graphique Audirep
   ============================================================ */

/* --- Variables CSS (palette Audirep — modernisée) --- */
:root {
    /* Bleus — plus profonds, plus élégants */
    --audirep-blue:       #1B2E4A;
    --audirep-blue-light: #2D4A7A;
    --audirep-blue-muted: #7181A0;
    --audirep-blue-pale:  #8094CB;
    --audirep-blue-wash:  #D4DAE8;
    --audirep-blue-bg:    #EEF1F8;

    /* Orange — légèrement adouci */
    --audirep-orange:       #E85A2D;
    --audirep-orange-light: #F07E3C;
    --audirep-orange-pale:  #F49C64;

    /* Jaune/Or */
    --audirep-yellow:       #FCC133;
    --audirep-yellow-light: #FED684;
    --audirep-yellow-pale:  #F4D8A6;

    /* Couleur dynamique par campagne (surchargeable inline) */
    --campaign-color: var(--audirep-orange);

    /* Neutres — tons chauds */
    --text-dark:  #1C1C28;
    --text-muted: #8A8680;
    --border:     #E8E4DD;
    --bg-light:   #F5F3EF;
    --bg-card:    #FFFFFF;

    /* Sémantiques */
    --success:    #2D9F6F;
    --danger:     #D64545;

    /* Typographie */
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body:    'Plus Jakarta Sans', 'Segoe UI', sans-serif;

    /* Ombres */
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md:  0 4px 12px rgba(27,46,74,0.08), 0 2px 4px rgba(27,46,74,0.04);
    --shadow-lg:  0 10px 25px rgba(27,46,74,0.1), 0 4px 10px rgba(27,46,74,0.05);

    /* Rayons */
    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --radius-full: 9999px;

    /* Transitions */
    --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Typographie --- */
body {
    font-family: var(--font-body);
    color: var(--text-dark);
    font-size: 0.925rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2 {
    font-family: var(--font-display);
    color: var(--audirep-blue);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }

h3, h4, h5, h6 {
    font-family: var(--font-body);
    color: var(--audirep-blue);
    font-weight: 700;
    line-height: 1.3;
}

h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 0.95rem; }
h6 { font-size: 0.85rem; }

small, .small { font-size: 0.8rem; }

.text-label {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

/* --- Surcharges Bootstrap : boutons --- */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-family: var(--font-body);
    letter-spacing: 0.02em;
    padding: 0.5rem 1.25rem;
    transition: all 0.2s var(--ease-out);
}

.btn:active { transform: scale(0.97); }

.btn i + span, .btn i:not(:last-child) { margin-right: 0.4rem; }

.btn-primary {
    background-color: var(--audirep-blue);
    border-color: var(--audirep-blue);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--audirep-blue-light);
    border-color: var(--audirep-blue-light);
    box-shadow: 0 4px 12px rgba(27,46,74,0.25);
}

.btn-accent {
    background-color: var(--audirep-orange);
    border-color: var(--audirep-orange);
    color: #fff;
}
.btn-accent:hover, .btn-accent:focus {
    background-color: var(--audirep-orange-light);
    border-color: var(--audirep-orange-light);
    color: #fff;
    box-shadow: 0 4px 12px rgba(232,90,45,0.3);
}

.btn-outline-primary {
    color: var(--audirep-blue);
    border-color: var(--audirep-blue);
    border-width: 1.5px;
}
.btn-outline-primary:hover {
    background-color: var(--audirep-blue);
    color: #fff;
    box-shadow: 0 4px 12px rgba(27,46,74,0.2);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--audirep-blue);
    padding: 0.5rem 1rem;
}
.btn-ghost:hover {
    background-color: var(--audirep-blue-bg);
    color: var(--audirep-blue);
}

.btn-campaign {
    background-color: var(--campaign-color);
    border-color: var(--campaign-color);
    color: #fff;
}
.btn-campaign:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-danger {
    background-color: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover {
    background-color: #c03030;
    border-color: #c03030;
}

.btn-success {
    background-color: var(--success);
    border-color: var(--success);
}
.btn-success:hover {
    background-color: #258a5c;
    border-color: #258a5c;
}

/* --- Surcharges Bootstrap : navbar, links --- */
a {
    color: var(--audirep-blue);
}
a:hover {
    color: var(--audirep-orange);
}

.bg-audirep-dark {
    background-color: var(--audirep-blue) !important;
}

.text-audirep-dark {
    color: var(--audirep-blue) !important;
}

.text-audirep-orange {
    color: var(--audirep-orange) !important;
}

.border-audirep {
    border-color: var(--audirep-blue) !important;
}

/* --- Cards --- */
.card {
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-campaign {
    border-top: 3px solid var(--campaign-color, var(--audirep-orange));
    cursor: pointer;
    transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}

.card-campaign:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.card-activity {
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    transition: all 0.25s var(--ease-out);
}

.card-activity:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-activity.completed {
    opacity: 0.7;
    border-left: 3px solid var(--success);
}

.card-activity.locked {
    opacity: 0.5;
    pointer-events: none;
}

/* --- KPI Cards (dashboard) --- */
.kpi-card {
    border-radius: var(--radius-md);
    border: none;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.kpi-card .kpi-value {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 400;
    color: var(--audirep-blue);
    line-height: 1;
}

.kpi-card .kpi-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-top: 0.25rem;
}

.kpi-card .kpi-icon {
    font-size: 2.5rem;
    color: var(--audirep-orange);
    opacity: 0.6;
}

/* --- Sidebar Admin --- */
#admin-sidebar {
    width: 240px;
    min-height: 100vh;
    background: linear-gradient(180deg, #1B2E4A 0%, #162540 100%) !important;
    transition: transform 0.3s var(--ease-out);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

#admin-sidebar .sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08) !important;
}

#admin-sidebar .sidebar-header img {
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

#admin-sidebar .nav {
    padding: 0.75rem 0.75rem;
}

#admin-sidebar .nav-item {
    margin-bottom: 2px;
}

#admin-sidebar .nav-link {
    padding: 0.6rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s var(--ease-out);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    position: relative;
    color: rgba(255,255,255,0.7) !important;
}

#admin-sidebar .nav-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

#admin-sidebar .nav-link:hover {
    background-color: rgba(255,255,255,0.08);
    color: #fff !important;
}

#admin-sidebar .nav-link.active {
    background-color: rgba(255,255,255,0.12);
    color: #fff !important;
}

#admin-sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--audirep-orange);
    border-radius: 0 2px 2px 0;
}

#admin-sidebar .sidebar-separator {
    border-top: 1px solid rgba(255,255,255,0.06);
    margin: 0.5rem 0.85rem;
}

/* Sidebar scrollbar */
#admin-sidebar::-webkit-scrollbar { width: 4px; }
#admin-sidebar::-webkit-scrollbar-track { background: transparent; }
#admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* --- Admin topbar --- */
#admin-content {
    min-height: 100vh;
    background-color: var(--bg-light);
}

#admin-content > .navbar {
    background: var(--bg-card) !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 0.5rem 1.5rem;
}

/* Responsive sidebar */
@media (max-width: 991.98px) {
    #admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 1050;
        height: 100vh;
        overflow-y: auto;
        transform: translateX(-100%);
    }
    #admin-sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 25px rgba(0,0,0,0.3);
    }
    /* Backdrop */
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1040;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s var(--ease-out);
    }
    .sidebar-backdrop.show {
        opacity: 1;
        pointer-events: auto;
    }
}

/* --- Formulaires --- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    font-family: var(--font-body);
    padding: 0.55rem 0.85rem;
    transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.form-control:focus, .form-select:focus {
    border-color: var(--audirep-orange);
    box-shadow: 0 0 0 3px rgba(232, 90, 45, 0.12);
}

.form-label {
    font-weight: 600;
    color: var(--audirep-blue);
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.input-group-text {
    border-radius: var(--radius-sm);
    background-color: var(--bg-light);
    border: 1.5px solid var(--border);
    color: var(--text-muted);
}

/* --- Tables --- */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background-color: var(--bg-light);
    color: var(--audirep-blue);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: none;
    border-bottom: 2px solid var(--border);
    padding: 0.85rem 1rem;
}

.table tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr {
    transition: background-color 0.15s var(--ease-out);
}

.table tbody tr:hover {
    background-color: rgba(27, 46, 74, 0.02);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* --- Badges --- */
.badge-status {
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.4em 0.75em;
    border-radius: var(--radius-full);
    letter-spacing: 0.03em;
}

.badge-draft {
    background-color: rgba(252, 193, 51, 0.15);
    color: #9A7B00;
}
.badge-active {
    background-color: rgba(45, 159, 111, 0.12);
    color: var(--success);
}
.badge-archived {
    background-color: rgba(138, 134, 128, 0.12);
    color: var(--text-muted);
}

/* --- Progression --- */
.progress-campaign {
    height: 6px;
    border-radius: var(--radius-full);
    background-color: var(--border);
    overflow: hidden;
}

.progress-campaign .progress-bar {
    background-color: var(--campaign-color, var(--audirep-orange));
    border-radius: var(--radius-full);
    transition: width 0.8s var(--ease-out);
}

/* --- Page de login --- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

.login-branding {
    flex: 1;
    background: linear-gradient(135deg, #EEF1F8 0%, #E2E6F0 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 3rem;
}

/* Motif géométrique décoratif */
.login-branding::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border: 60px solid rgba(232, 90, 45, 0.1);
    border-radius: 50%;
    top: -80px;
    right: -100px;
}

.login-branding::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border: 40px solid rgba(26, 58, 105, 0.06);
    border-radius: 50%;
    bottom: -60px;
    left: -80px;
}

.login-branding img {
    max-width: 180px;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.login-branding h2 {
    color: var(--audirep-blue);
    font-family: var(--font-display);
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.login-branding p {
    color: var(--text-muted);
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    padding: 3rem;
}

.login-card {
    max-width: 400px;
    width: 100%;
    border: none;
    box-shadow: none;
    background: transparent;
    border-radius: 0;
    animation: loginSlideIn 0.5s var(--ease-out);
}

.login-card .form-control {
    background-color: var(--bg-light);
    border: 1.5px solid transparent;
}

.login-card .form-control:focus {
    background-color: var(--bg-card);
    border-color: var(--audirep-orange);
}

@keyframes loginSlideIn {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@media (max-width: 767.98px) {
    .login-branding { display: none; }
    .login-form-side {
        padding: 2rem 1.5rem;
        background: linear-gradient(180deg, var(--bg-light) 0%, var(--bg-card) 30%);
    }
}

/* --- Utilitaires --- */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hover-lift {
    transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}
.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* --- Navbar participant/client --- */
.navbar.bg-white, .navbar.border-bottom {
    background: var(--bg-card) !important;
    border-bottom-color: var(--border) !important;
}

.navbar .navbar-brand img {
    transition: opacity 0.2s var(--ease-out);
}

.navbar .navbar-brand:hover img {
    opacity: 0.8;
}

.navbar .nav-link {
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s var(--ease-out);
}

/* --- Footer --- */
footer {
    background: var(--bg-card) !important;
    border-top-color: var(--border) !important;
}

/* --- Dropdown menus --- */
.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: background-color 0.15s var(--ease-out);
}

.dropdown-item:hover {
    background-color: var(--bg-light);
}

/* --- List groups --- */
.list-group-item {
    border-color: var(--border);
    transition: background-color 0.15s var(--ease-out);
}

.list-group-item:hover {
    background-color: rgba(27, 46, 74, 0.02);
}

/* --- Alerts (flash messages) --- */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
}

/* --- Breadcrumbs --- */
.breadcrumb {
    font-size: 0.8rem;
}

.breadcrumb-item a {
    color: var(--text-muted);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--audirep-orange);
}

.breadcrumb-item.active {
    color: var(--audirep-blue);
    font-weight: 600;
}

/* --- Animations --- */
.fade-in {
    animation: fadeIn 0.4s var(--ease-out);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Staggered entrance for cards */
.stagger-in > * {
    opacity: 0;
    animation: fadeInUp 0.4s var(--ease-out) forwards;
}
.stagger-in > *:nth-child(1) { animation-delay: 0s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.05s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.1s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.15s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.2s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.25s; }
.stagger-in > *:nth-child(7) { animation-delay: 0.3s; }
.stagger-in > *:nth-child(8) { animation-delay: 0.35s; }
.stagger-in > *:nth-child(n+9) { animation-delay: 0.4s; }

/* Scroll reveal */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Badge pulse (unread) */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.badge-pulse {
    animation: pulse 2s infinite;
}

/* Toast slide-in */
.toast-container .toast {
    animation: slideInRight 0.3s var(--ease-out);
    border-radius: var(--radius-sm);
}

/* --- Accessibilité --- */
*:focus-visible {
    outline: 2px solid var(--audirep-orange);
    outline-offset: 2px;
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    padding: 0.5rem 1rem;
    background: var(--audirep-blue);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    text-decoration: none;
}

.skip-link:focus {
    top: 1rem;
}

/* --- Page content background --- */
body.bg-light {
    background-color: var(--bg-light) !important;
}

/* ============================================================
   Responsive enhancements
   ============================================================ */

/* Touch targets minimum 44px on mobile */
@media (max-width: 767.98px) {
    .btn-sm {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .list-group-item {
        padding: 0.85rem 1rem;
    }

    /* Cards : padding plus généreux sur mobile */
    .card-body {
        padding: 1.25rem;
    }

    /* KPI grid : 2 colonnes propres */
    .kpi-card {
        margin-bottom: 0.75rem;
    }

    /* Titres plus petits sur mobile */
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.35rem; }
    h3 { font-size: 1.1rem; }

    /* Contenu admin : padding réduit */
    #admin-content > .p-4,
    .p-4 {
        padding: 1rem !important;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 991.98px) {
    #admin-content > .p-4 {
        padding: 1.5rem !important;
    }
}

/* Large screens : content max-width for readability */
@media (min-width: 1400px) {
    #admin-content > .p-4 {
        max-width: 1320px;
    }
}

/* --- Textarea auto-resize --- */
textarea.auto-resize {
    min-height: 6.5em; /* ~4 rows */
    max-height: 400px;
    overflow-y: auto;
    resize: vertical;
    transition: height 0.15s var(--ease-out);
}

/* --- Emoji picker (questions ouvertes) --- */
.emoji-picker-dropdown {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    width: 280px;
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 8px;
    z-index: 50;
}
.emoji-group-label {
    font-size: .7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 4px 2px 2px;
}
.emoji-pick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 1.25rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .12s;
    user-select: none;
}
.emoji-pick:hover,
.emoji-pick:focus-visible {
    background: var(--audirep-blue-bg);
}
.emoji-toggle-btn {
    font-size: 1.1rem;
    padding: 2px 6px;
    line-height: 1;
    color: var(--text-muted);
}
.emoji-toggle-btn:hover {
    color: var(--audirep-orange);
}

/* --- Media thumbnail lightbox --- */
.media-thumb {
    transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.media-thumb:hover {
    transform: scale(1.04);
    box-shadow: var(--shadow-md);
}
#mediaLightbox .modal-dialog {
    max-width: 95vw;
}
#mediaLightbox .modal-content {
    background: rgba(0,0,0,0.85) !important;
    backdrop-filter: blur(4px);
}

/* Print styles */
@media print {
    #admin-sidebar,
    .navbar,
    .skip-link,
    .btn,
    footer { display: none !important; }

    #admin-content {
        margin-left: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    body { font-size: 12pt; }
}
