/* ============================================
   SOCIAL COLLAB - CSS Mobile First
   ============================================ */

/* -- Reset & Base -- */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

:root {
    --primary: #D85A30;
    --primary-light: #FAECE7;
    --primary-dark: #993C1D;

    --recv-bg: #FEF3C7; --recv-text: #92400E;
    --prog-bg: #FFEDD5; --prog-text: #9A3412;
    --val-bg: #E6F1FB;  --val-text: #0C447C;
    --ok-bg: #E1F5EE;   --ok-text: #085041;
    --pub-bg: #EEEDFE;  --pub-text: #3C3489;

    --ig-bg: #FBEAF0; --ig-text: #993556;
    --fb-bg: #E6F1FB; --fb-text: #0C447C;
    --li-bg: #E6F1FB; --li-text: #185FA5;
    --tk-bg: #F1EFE8; --tk-text: #444441;

    --bg: #FFFFFF;
    --bg2: #F5F4F0;
    --bg3: #EEEDEA;
    --text: #1A1A1A;
    --text2: #6B6B6B;
    --text3: #9B9B9B;
    --border: #E5E4E0;
    --border2: #D1D0CC;

    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);

    --nav-height: 56px;
    --header-height: 54px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--bg2);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: calc(var(--nav-height) + 16px);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
img, video { max-width: 100%; height: auto; display: block; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }

/* -- Utilities -- */
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
.container { width: 100%; max-width: 800px; margin: 0 auto; padding: 0 12px; }
.container-wide { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 12px; }

/* -- Header fixe -- */
.header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--header-height);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px;
}
.header-title { font-size: 16px; font-weight: 600; color: var(--text); }
.header-title span { color: var(--primary); }
.header-back { width: 36px; height: 36px; border-radius: var(--radius); border: none; background: transparent; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--text); }
.header-actions { display: flex; gap: 8px; align-items: center; }

body { padding-top: var(--header-height); }

/* -- Navigation bottom -- */
.nav-bottom {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    height: var(--nav-height);
    background: var(--bg);
    border-top: 1px solid var(--border);
    display: flex;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    text-decoration: none; color: var(--text3); font-size: 10px; font-weight: 500;
    transition: color 0.15s;
    border: none; background: transparent;
    position: relative;
}
.nav-item.active { color: var(--primary); }
.nav-item svg { width: 22px; height: 22px; }
.nav-badge {
    position: absolute; top: 4px; right: calc(50% - 18px);
    width: 8px; height: 8px; border-radius: 50%;
    background: #E24B4A; border: 2px solid var(--bg);
}

/* -- Badges & Pills -- */
.badge {
    display: inline-flex; align-items: center;
    font-size: 11px; font-weight: 600; padding: 3px 10px;
    border-radius: var(--radius-full); white-space: nowrap;
}
.badge-recv { background: var(--recv-bg); color: var(--recv-text); }
.badge-prog { background: var(--prog-bg); color: var(--prog-text); }
.badge-val  { background: var(--val-bg);  color: var(--val-text); }
.badge-ok   { background: var(--ok-bg);   color: var(--ok-text); }
.badge-pub  { background: var(--pub-bg);  color: var(--pub-text); }

.plat {
    display: inline-flex; align-items: center;
    font-size: 10px; font-weight: 600; padding: 2px 7px;
    border-radius: 4px;
}
.plat-ig { background: var(--ig-bg); color: var(--ig-text); }
.plat-fb { background: var(--fb-bg); color: var(--fb-text); }
.plat-li { background: var(--li-bg); color: var(--li-text); }
.plat-tk { background: var(--tk-bg); color: var(--tk-text); }

/* -- Buttons -- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border-radius: var(--radius);
    font-size: 14px; font-weight: 600; border: none;
    transition: transform 0.1s, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: #0F6E56; color: #fff; }
.btn-danger  { background: #FCEBEB; color: #A32D2D; }
.btn-outline { background: transparent; border: 1px solid var(--border2); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius); }

/* -- Cards -- */
.card {
    background: var(--bg); border-radius: var(--radius-lg);
    border: 1px solid var(--border); overflow: hidden;
}
.card + .card { margin-top: 10px; }

/* -- Form elements -- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.form-input {
    width: 100%; padding: 10px 14px;
    border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--bg); color: var(--text);
    font-size: 14px; transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--primary); }
.form-input::placeholder { color: var(--text3); }
textarea.form-input { resize: vertical; min-height: 80px; }

/* -- Chip selector -- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    font-size: 12px; padding: 6px 14px; border-radius: var(--radius);
    border: 1px solid var(--border); background: transparent;
    color: var(--text2); font-weight: 500; transition: all 0.15s;
}
.chip.active { border-color: transparent; }
.chip-ig.active { background: var(--ig-bg); color: var(--ig-text); }
.chip-fb.active { background: var(--fb-bg); color: var(--fb-text); }
.chip-li.active { background: var(--li-bg); color: var(--li-text); }
.chip-tk.active { background: var(--tk-bg); color: var(--tk-text); }
.chip-obj.active { background: var(--recv-bg); color: var(--recv-text); }

/* -- Drop zone upload -- */
.drop-zone {
    border: 2px dashed var(--primary); border-radius: var(--radius-lg);
    padding: 28px 16px; text-align: center; cursor: pointer;
    background: rgba(216,90,48,0.04); transition: background 0.15s;
}
.drop-zone:hover, .drop-zone.dragover { background: rgba(216,90,48,0.1); }
.drop-zone-text { font-size: 14px; color: var(--primary); font-weight: 600; }
.drop-zone-sub { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* -- Upload previews -- */
.upload-previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.upload-preview {
    position: relative; width: 72px; height: 72px;
    border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border);
}
.upload-preview img, .upload-preview video { width: 100%; height: 100%; object-fit: cover; }
.upload-preview-remove {
    position: absolute; top: 2px; right: 2px;
    width: 20px; height: 20px; border-radius: 50%;
    background: rgba(0,0,0,0.6); color: #fff;
    border: none; font-size: 12px; display: flex; align-items: center; justify-content: center;
}
.upload-preview-video::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    width: 0; height: 0;
    border-style: solid; border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent #fff;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* -- Post card -- */
.post-card {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
.post-card:last-child { border-bottom: none; }
.post-card:active { background: var(--bg2); }
.post-thumb {
    width: 52px; height: 52px; border-radius: var(--radius);
    flex-shrink: 0; overflow: hidden; background: var(--bg2);
    display: flex; align-items: center; justify-content: center;
}
.post-thumb img, .post-thumb video { width: 100%; height: 100%; object-fit: cover; }
.post-thumb-placeholder { font-size: 10px; color: var(--text3); font-weight: 600; }
.post-body { flex: 1; min-width: 0; }
.post-title { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-sub { font-size: 12px; color: var(--text2); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.post-status { flex-shrink: 0; }

/* -- Carousel viewer -- */
.carousel {
    position: relative; width: 100%; aspect-ratio: 1;
    border-radius: var(--radius-lg); overflow: hidden;
    background: var(--bg3); touch-action: pan-y;
}
.carousel-track {
    display: flex; width: 100%; height: 100%;
    transition: transform 0.3s ease;
}
.carousel-slide { flex: 0 0 100%; width: 100%; height: 100%; }
.carousel-slide img, .carousel-slide video {
    width: 100%; height: 100%; object-fit: cover;
}
.carousel-dots {
    position: absolute; bottom: 10px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 6px;
}
.carousel-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: rgba(255,255,255,0.5); border: none; padding: 0;
    transition: background 0.2s;
}
.carousel-dot.active { background: #fff; }
.carousel-counter {
    position: absolute; top: 10px; right: 10px;
    background: rgba(0,0,0,0.5); color: #fff;
    font-size: 11px; font-weight: 600;
    padding: 3px 8px; border-radius: var(--radius-full);
}
.carousel-video-play {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    width: 56px; height: 56px; border-radius: 50%;
    background: rgba(0,0,0,0.5); border: none;
    display: flex; align-items: center; justify-content: center;
}
.carousel-video-play::after {
    content: ''; width: 0; height: 0;
    border-style: solid; border-width: 10px 0 10px 18px;
    border-color: transparent transparent transparent #fff;
    margin-left: 3px;
}

/* -- Chat / Comments -- */
.chat-list { padding: 12px 14px; }
.chat-msg { margin-bottom: 10px; max-width: 85%; }
.chat-msg-agency { }
.chat-msg-client { margin-left: auto; }
.chat-bubble {
    padding: 8px 12px; border-radius: 12px;
    font-size: 13px; line-height: 1.5;
}
.chat-msg-agency .chat-bubble { background: var(--primary-light); color: var(--primary-dark); border-bottom-left-radius: 3px; }
.chat-msg-client .chat-bubble { background: var(--val-bg); color: var(--val-text); border-bottom-right-radius: 3px; }
.chat-author { font-size: 11px; font-weight: 600; margin-bottom: 2px; }
.chat-time { font-size: 10px; opacity: 0.6; margin-top: 2px; }
.chat-input-bar {
    display: flex; gap: 8px; padding: 10px 14px;
    border-top: 1px solid var(--border); background: var(--bg);
}
.chat-input {
    flex: 1; padding: 8px 12px; border-radius: 20px;
    border: 1px solid var(--border); background: var(--bg2);
    font-size: 13px; color: var(--text); outline: none;
}
.chat-input:focus { border-color: var(--primary); background: var(--bg); }
.chat-send {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary); color: #fff; border: none;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}

/* -- Stat cards -- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px; }
.stat-card { padding: 10px; border-radius: var(--radius); text-align: center; }
.stat-num { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 10px; font-weight: 600; }
.stat-recv  { background: var(--recv-bg); }
.stat-recv .stat-num { color: var(--recv-text); }
.stat-recv .stat-label { color: var(--recv-text); }
.stat-prog  { background: var(--prog-bg); }
.stat-prog .stat-num { color: var(--prog-text); }
.stat-prog .stat-label { color: var(--prog-text); }
.stat-val   { background: var(--val-bg); }
.stat-val .stat-num { color: var(--val-text); }
.stat-val .stat-label { color: var(--val-text); }
.stat-pub   { background: var(--pub-bg); }
.stat-pub .stat-num { color: var(--pub-text); }
.stat-pub .stat-label { color: var(--pub-text); }

/* -- Alert bar -- */
.alert { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); margin: 12px; }
.alert-danger { background: #FCEBEB; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; background: #E24B4A; flex-shrink: 0; }
.alert-text { flex: 1; font-size: 12px; color: #791F1F; }
.alert-btn { font-size: 11px; padding: 4px 12px; border-radius: 6px; background: #E24B4A; color: #fff; border: none; font-weight: 600; }
.alert-success { background: var(--ok-bg); }
.alert-success .alert-text { color: var(--ok-text); }

/* -- Client card (dashboard) -- */
.client-header { display: flex; align-items: center; gap: 10px; padding: 14px; }
.client-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.client-info { flex: 1; min-width: 0; }
.client-name { font-size: 14px; font-weight: 600; color: var(--text); }
.client-count { font-size: 11px; color: var(--text2); }
.client-badges { display: flex; gap: 4px; flex-wrap: wrap; }

/* -- Calendar -- */
.cal-week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 0 8px; }
.cal-day {
    text-align: center; padding: 8px 0; border-radius: var(--radius);
    cursor: pointer; transition: background 0.15s;
}
.cal-day:active { background: var(--bg3); }
.cal-day.active { background: var(--primary-light); }
.cal-day-label { font-size: 10px; color: var(--text3); margin-bottom: 2px; }
.cal-day-num { font-size: 15px; font-weight: 600; color: var(--text); }
.cal-day.today .cal-day-num {
    background: var(--primary); color: #fff;
    width: 28px; height: 28px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
}
.cal-day-dots { display: flex; justify-content: center; gap: 3px; margin-top: 4px; min-height: 6px; }
.cal-day-dot { width: 5px; height: 5px; border-radius: 50%; }

/* -- Section labels -- */
.section-label { font-size: 12px; font-weight: 600; color: var(--text3); padding: 10px 14px 6px; text-transform: uppercase; letter-spacing: 0.5px; }

/* -- Tab bar -- */
.tabs { display: flex; gap: 4px; padding: 8px 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    font-size: 12px; padding: 6px 14px; border-radius: var(--radius);
    border: none; background: transparent; color: var(--text2);
    font-weight: 500; white-space: nowrap;
}
.tab.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }

/* -- View toggle (semaine/mois/liste) -- */
.view-toggle { display: flex; gap: 4px; padding: 8px 16px; }
.view-toggle .tab { flex: 1; text-align: center; }

/* -- Flash messages -- */
.flash { padding: 12px 16px; margin: 12px; border-radius: var(--radius); font-size: 13px; font-weight: 500; }
.flash-success { background: var(--ok-bg); color: var(--ok-text); }
.flash-error { background: #FCEBEB; color: #A32D2D; }

/* -- Empty state -- */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state-icon { font-size: 40px; margin-bottom: 10px; opacity: 0.3; }
.empty-state-text { font-size: 14px; color: var(--text3); }

/* -- Upcoming list -- */
.upcoming-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; }
.upcoming-dot { width: 8px; height: 8px; border-radius: 3px; flex-shrink: 0; }
.upcoming-text { flex: 1; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upcoming-date { font-size: 11px; color: var(--text3); flex-shrink: 0; }

/* -- Login page -- */
.login-container {
    min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 24px;
}
.login-box { width: 100%; max-width: 360px; }
.login-logo { font-size: 28px; font-weight: 700; text-align: center; margin-bottom: 8px; color: var(--text); }
.login-logo span { color: var(--primary); }
.login-subtitle { text-align: center; font-size: 14px; color: var(--text2); margin-bottom: 32px; }

/* ============================================
   Desktop (> 768px)
   ============================================ */
@media (min-width: 769px) {
    :root {
        --nav-height: 0px;
        --header-height: 60px;
    }

    body { padding-bottom: 0; }
    .nav-bottom { display: none; }

    .desktop-sidebar {
        position: fixed; top: var(--header-height); left: 0; bottom: 0;
        width: 220px; background: var(--bg); border-right: 1px solid var(--border);
        padding: 16px 0;
    }
    .desktop-sidebar .nav-item {
        flex-direction: row; justify-content: flex-start; gap: 10px;
        padding: 8px 20px; font-size: 13px;
    }

    .main-with-sidebar { margin-left: 220px; }

    .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }

    .container { max-width: 700px; }
    .container-wide { max-width: 1100px; }

    .post-detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
    .post-detail-layout .post-preview { border-right: 1px solid var(--border); }
}
