:root {
    --bg-color: #090909;
    --surface-color: #1a1a1a;
    --surface-hover: #2a2a2a;
    --accent-color: #F4EA40;
    --accent-hover: #e0d635;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --status-approved: #4ade80;
    --status-pending: #F4EA40;
    --status-reject: #f87171;
    --border-color: #222;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100dvh;
    overflow-x: hidden;
}

h1, h2, h3 { font-family: 'Sora', sans-serif; }

.hidden { display: none !important; }

/* ═══════════════════════════════════════
   LOADING
   ═══════════════════════════════════════ */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-color);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ═══════════════════════════════════════
   CLIENT SELECTOR
   ═══════════════════════════════════════ */
.selector-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 48px 20px;
}

.selector-header {
    text-align: center;
    margin-bottom: 40px;
}

.selector-header h1 {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-top: 12px;
}

.selector-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 6px;
}

.selector-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.selector-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, background 0.2s;
}

.selector-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-color);
    background: var(--surface-hover);
}

.selector-card:active { transform: scale(0.97); }

.selector-logo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 14px;
    display: block;
}

.selector-logo-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--surface-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    font-family: 'Sora', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-color);
}

.selector-name {
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.selector-handle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════
   PAUTAS LIST
   ═══════════════════════════════════════ */
.pautas-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.pautas-client-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pautas-client-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.pautas-client-info h2 { font-size: 1.2rem; }

.btn-back {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: border-color 0.2s, color 0.2s;
    flex-shrink: 0;
}

.btn-back:hover {
    border-color: var(--accent-color);
    color: var(--text-primary);
}

.pautas-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pauta-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, border-color 0.2s, background 0.2s;
}

.pauta-card:hover {
    transform: translateX(3px);
    border-color: var(--accent-color);
    background: var(--surface-hover);
}

.pauta-card:active { transform: scale(0.99); }

.pauta-name { font-size: 0.95rem; margin-bottom: 3px; }
.pauta-count { font-size: 0.8rem; color: var(--text-secondary); }
.pauta-arrow { font-size: 1.1rem; color: var(--accent-color); flex-shrink: 0; }

/* ═══════════════════════════════════════
   BOARD HEADER
   ═══════════════════════════════════════ */
.app-header {
    background: var(--surface-color);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.logo-metrix {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent-color);
    flex-shrink: 0;
}

.logo-metrix svg { width: 28px; height: 28px; }

.client-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 16px;
    border-left: 1px solid var(--border-color);
    min-width: 0;
}

.client-info img {
    height: 32px;
    width: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.client-info h1 {
    font-size: 0.95rem;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-bar {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.status-chip {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--surface-hover);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.status-chip.approved::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--status-approved); }
.status-chip.pending::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--status-pending); }
.status-chip.rejected::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--status-reject); }

/* ═══════════════════════════════════════
   BOARD GRID + SECTIONS
   ═══════════════════════════════════════ */
.posts-grid {
    padding: 24px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.section-header.pending-section {
    margin-top: 40px;
    opacity: 0.5;
}

.section-title { font-size: 1rem; font-weight: 600; }
.section-count { font-size: 0.8rem; color: var(--text-secondary); }

.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 12px;
}

/* ═══════════════════════════════════════
   POST CARDS
   ═══════════════════════════════════════ */
.post-card {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-color);
}

.post-card:active { transform: scale(0.98); }

.post-card.no-media {
    cursor: default;
    opacity: 0.45;
}

.post-card.no-media:hover {
    transform: none;
    border-color: var(--border-color);
}

.no-media-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 0.8rem;
    font-style: italic;
}

.folder-preview {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--accent-color);
    font-size: 0.85rem;
    font-weight: 600;
    background: #111;
}

.folder-icon { font-size: 2rem; }

.folder-slide {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    aspect-ratio: 9/16;
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    background: #111;
    transition: background 0.2s;
}

.folder-slide:hover { background: #1a1a1a; }

.folder-slide-icon {
    font-size: 3rem;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(244, 234, 64, 0.1);
}

.card-preview {
    aspect-ratio: 4/5;
    background: #000;
    position: relative;
    overflow: hidden;
}

.card-preview.story { aspect-ratio: 9/16; }

.card-preview img, .card-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-type-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    padding: 5px;
    border-radius: 50%;
    color: white;
    display: flex;
    font-size: 0.75rem;
}

.card-body {
    padding: 14px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-title {
    font-size: 0.9rem;
    line-height: 1.35;
    color: var(--text-primary);
}

.card-caption-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.badge {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge.approved { background: rgba(74, 222, 128, 0.15); color: var(--status-approved); }
.badge.pending { background: rgba(244, 234, 64, 0.15); color: var(--status-pending); }
.badge.rejected { background: rgba(248, 113, 113, 0.15); color: var(--status-reject); }

/* ═══════════════════════════════════════
   MODAL — APPROVAL SCREEN
   ═══════════════════════════════════════ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-content {
    background: var(--surface-color);
    width: 100%;
    max-width: 920px;
    height: min(82vh, 700px);
    border-radius: var(--radius-lg);
    display: flex;
    position: relative;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 60px rgba(0,0,0,0.6);
    overflow: hidden;
}

.close-modal {
    position: absolute;
    top: 12px; right: 14px;
    background: rgba(0,0,0,0.4);
    border: none;
    color: #aaa;
    font-size: 1.6rem;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.close-modal:hover { background: rgba(255,255,255,0.1); color: #fff; }

.modal-split {
    display: flex;
    width: 100%;
    height: 100%;
}

.mockup-column {
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-width: 0;
}

.phone-frame {
    width: 88%;
    max-width: 380px;
    max-height: calc(82vh - 60px);
    background: #000;
    border: 3px solid #333;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    overflow-y: auto;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    scrollbar-width: none;
}

.phone-frame::-webkit-scrollbar { display: none; }

.phone-notch {
    position: sticky;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 20px;
    background: #222;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    z-index: 10;
    margin: 0 auto;
}

/* IG Post Styles */
.ig-post { margin-top: 8px; }

.ig-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 8px;
}

.ig-header img {
    width: 28px; height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.ig-username {
    font-size: 13px;
    font-weight: 600;
    flex-grow: 1;
}

.ig-media-container {
    width: 100%;
    background: #000;
    position: relative;
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.ig-media-container::-webkit-scrollbar { display: none; }

.ig-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    width: 100%;
    object-fit: contain;
    background: #000;
}

.ig-actions {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
}

.left-actions { display: flex; gap: 14px; }

.ig-actions svg { width: 22px; height: 22px; }

.ig-caption {
    padding: 0 12px 12px;
    font-size: 13px;
    line-height: 1.4;
}

.ig-carousel-dots {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 6px 0;
    background: #000;
}

.ig-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #555;
    transition: background 0.2s;
}

.ig-dot.active { background: var(--accent-color); }

/* Details Column */
.details-column {
    flex: 0.85;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.details-column h2 {
    font-size: 1.1rem;
    line-height: 1.3;
    padding-right: 32px;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.full-caption-box {
    background: var(--bg-color);
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    flex: 1;
    min-height: 0;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    overflow-y: auto;
}

.full-caption-box h3 {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Approval Actions */
.approval-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
    flex-shrink: 0;
}

.action-btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: filter 0.2s, transform 0.1s;
}

.action-btn:active { transform: scale(0.97); }
.action-btn:hover { filter: brightness(1.1); }

.btn-approve { background: var(--status-approved); color: #000; }

.btn-reject {
    background: transparent;
    color: var(--status-reject);
    border: 1px solid var(--status-reject);
}

/* Reject Form */
.reject-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-color);
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--status-reject);
}

.reject-form label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--status-reject);
}

.reject-form textarea {
    width: 100%;
    height: 80px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: white;
    padding: 10px;
    border-radius: var(--radius-sm);
    resize: vertical;
    font-size: 0.88rem;
    font-family: inherit;
}

.reject-form textarea:focus {
    outline: none;
    border-color: var(--status-reject);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 14px;
    font-size: 0.85rem;
}

.btn-primary {
    background: var(--status-reject);
    border: none;
    color: white;
    border-radius: 6px;
    padding: 8px 20px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* Confetti */
.confetti-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

/* Toast */
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ═══════════════════════════════════════
   TABLET (max 900px)
   ═══════════════════════════════════════ */
@media (max-width: 900px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 16px;
        gap: 10px;
    }

    .client-info { padding-left: 0; border-left: none; }
    .status-bar { flex-wrap: wrap; gap: 6px; }

    .posts-grid { padding: 20px 16px; }

    .section-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 14px;
    }

    /* Modal: single scrollable column on tablet */
    .modal { padding: 12px; }
    .modal-content {
        height: auto;
        max-height: 95vh;
        max-width: 480px;
        border-radius: 16px;
        flex-direction: column;
        overflow-y: auto;
    }
    .modal-split { flex-direction: column; height: auto; }
    .mockup-column {
        flex: none;
        height: auto;
        padding: 0;
    }
    .phone-frame {
        width: 100%;
        max-width: 100%;
        max-height: none;
        border-radius: 0;
        border-width: 0;
        overflow: visible;
    }
    .phone-notch { display: none; }
    .ig-post { margin-top: 0; }
    .details-column {
        flex: none;
        padding: 20px 16px;
        overflow-y: visible;
    }
    .full-caption-box { flex: none; }

    /* Selector */
    .selector-container { padding: 32px 16px; }
    .selector-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .selector-card { padding: 20px 12px; }
    .selector-logo, .selector-logo-placeholder { width: 48px; height: 48px; }
}

/* ═══════════════════════════════════════
   MOBILE (max 600px)
   ═══════════════════════════════════════ */
@media (max-width: 600px) {
    .section-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .card-body { padding: 10px; gap: 6px; }
    .card-title { font-size: 0.82rem; }
    .card-caption-preview { display: none; }

    .brand-container { gap: 10px; }
    .logo-metrix span { display: none; }
    .logo-metrix svg { width: 24px; height: 24px; }

    .status-chip { font-size: 0.7rem; padding: 4px 8px; }

    /* Modal fullscreen scrollable on mobile */
    .modal { padding: 0; }
    .modal-content {
        width: 100%;
        height: 100dvh;
        max-width: 100%;
        max-height: 100dvh;
        border-radius: 0;
        flex-direction: column;
        overflow-y: auto;
    }
    .modal-split { flex-direction: column; height: auto; }
    .mockup-column {
        flex: none;
        height: auto;
        padding: 0;
    }
    .phone-frame {
        width: 100%;
        max-width: 100%;
        max-height: none;
        border-radius: 0;
        border-width: 0;
        overflow: visible;
    }
    .phone-notch { display: none; }
    .ig-post { margin-top: 0; }

    .details-column {
        flex: none;
        padding: 16px;
        gap: 12px;
        overflow-y: visible;
    }
    .details-column h2 { font-size: 1rem; padding-right: 40px; }
    .full-caption-box { padding: 12px; font-size: 0.85rem; flex: none; }
    .approval-actions { gap: 8px; padding-bottom: 20px; }
    .action-btn { padding: 14px; font-size: 0.9rem; }
    .close-modal { top: 8px; right: 8px; }

    /* Selector */
    .selector-container { padding: 28px 16px; }
    .selector-header { margin-bottom: 28px; }
    .selector-header h1 { font-size: 1.3rem; }
    .selector-grid { gap: 10px; }
    .selector-card { padding: 18px 10px; }
    .selector-name { font-size: 0.85rem; }
    .selector-logo, .selector-logo-placeholder { width: 44px; height: 44px; font-size: 1.1rem; }

    .pauta-card { padding: 14px 16px; }
    .pauta-name { font-size: 0.88rem; }
}

/* ═══════════════════════════════════════
   SMALL MOBILE (max 380px)
   ═══════════════════════════════════════ */
@media (max-width: 380px) {
    .section-grid { grid-template-columns: 1fr; }
    .selector-grid { grid-template-columns: 1fr; }
    .approval-actions { flex-direction: column; }
}
