/* Editorial Dashboard - Client CSS
   Light theme, mobile-first, brand FIN teal #3AA6B9
   System font stack as per brand guidelines */

:root {
    --primary: #3AA6B9;
    --primary-dark: #2E8A9A;
    --primary-light: #E8F4F8;
    --bg: #F9FAFB;
    --bg-card: #FFFFFF;
    --text: #1F2937;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    --border: #E5E7EB;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;
    --grey: #9CA3AF;
    --grey-light: #F3F4F6;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --radius: 10px;
    --radius-sm: 6px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* === LAYOUT === */
.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.app-header .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 16px;
    color: var(--primary);
}

.app-header .logo span { color: var(--text); font-weight: 400; font-size: 14px; }

.app-header .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

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

/* === STATS CARDS === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.stat-card.pending { border-left-color: var(--warning); }
.stat-card.published { border-left-color: var(--success); }
.stat-card.quality { border-left-color: var(--info); }

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* === CALENDAR === */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.calendar-header h2 { font-size: 18px; font-weight: 600; }

.calendar-nav {
    display: flex;
    gap: 8px;
}

.btn-nav {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.btn-nav:hover { border-color: var(--primary); color: var(--primary); }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
}

.calendar-day-header {
    background: var(--primary);
    color: white;
    padding: 8px 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.calendar-day {
    background: var(--bg-card);
    min-height: 80px;
    padding: 6px;
    position: relative;
}

.calendar-day.today { background: var(--primary-light); }
.calendar-day.other-month { background: var(--grey-light); opacity: 0.5; }

.calendar-day .day-number {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.calendar-day .day-posts { display: flex; flex-direction: column; gap: 2px; }

.post-dot {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s;
}
.post-dot:hover { opacity: 0.8; }

.post-dot .platform-icon { font-size: 10px; width: 14px; text-align: center; }

/* Platform colors */
.post-dot.facebook { background: #E8F0FE; color: #1877F2; }
.post-dot.instagram { background: #FCE4EC; color: #E4405F; }
.post-dot.linkedin { background: #E8F4FD; color: #0A66C2; }

/* Status indicators */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge.draft { background: var(--grey-light); color: var(--grey); }
.status-badge.content_ready { background: var(--info-light); color: var(--info); }
.status-badge.pending_approval { background: var(--warning-light); color: var(--warning); }
.status-badge.queued { background: var(--info-light); color: var(--info); }
.status-badge.publishing { background: var(--info-light); color: var(--info); }
.status-badge.published { background: var(--success-light); color: var(--success); }
.status-badge.verified { background: var(--success-light); color: var(--success); }
.status-badge.failed { background: var(--danger-light); color: var(--danger); }
.status-badge.rejected { background: var(--grey-light); color: var(--grey); text-decoration: line-through; }

/* === POST LIST === */
.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-list { display: flex; flex-direction: column; gap: 8px; }

.post-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: box-shadow 0.2s;
    border-left: 3px solid transparent;
}
.post-card:hover { box-shadow: var(--shadow-md); }
.post-card.pending_approval { border-left-color: var(--warning); }
.post-card.published, .post-card.verified { border-left-color: var(--success); }
.post-card.failed { border-left-color: var(--danger); }

.post-card .platform-badge {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.platform-badge.facebook { background: #E8F0FE; }
.platform-badge.instagram { background: #FCE4EC; }
.platform-badge.linkedin { background: #E8F4FD; }

.post-card .post-info { flex: 1; min-width: 0; }
.post-card .post-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.post-card .post-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.post-card .post-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #D97706; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* === POST DETAIL === */
.post-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--text-secondary);
}
.back-link:hover { color: var(--primary); }

.content-preview {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.content-preview h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.copy-preview {
    background: var(--grey-light);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.image-preview {
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
    max-height: 300px;
}
.image-preview img { width: 100%; height: auto; object-fit: cover; display: block; }

.article-preview {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.article-preview .article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    background: var(--grey-light);
    color: var(--text-secondary);
}

.quality-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.quality-badge.high { background: var(--success-light); color: var(--success); }
.quality-badge.medium { background: var(--warning-light); color: var(--warning); }
.quality-badge.low { background: var(--danger-light); color: var(--danger); }

/* Approval bar */
.approval-bar {
    background: var(--warning-light);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.approval-bar .approval-text { font-size: 14px; font-weight: 500; }
.approval-bar .approval-actions { display: flex; gap: 8px; }

.revision-form {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    display: none;
}

.revision-form textarea {
    width: 100%;
    min-height: 80px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    font-family: var(--font);
    font-size: 14px;
    resize: vertical;
    margin-bottom: 8px;
}

.client-note {
    background: var(--warning-light);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px;
    border-left: 3px solid var(--warning);
}

/* === LOGIN PAGE === */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: linear-gradient(135deg, var(--bg) 0%, var(--primary-light) 100%);
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
}

.login-card .logo-big {
    text-align: center;
    margin-bottom: 24px;
}
.login-card .logo-big h1 {
    font-size: 22px;
    color: var(--primary);
    font-weight: 700;
}
.login-card .logo-big p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    transition: border-color 0.2s;
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(58, 166, 185, 0.15);
}

.error-msg {
    background: var(--danger-light);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.btn-login {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
}

/* === TABS === */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
}

.tab {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* === LOADING === */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 14px;
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* === FOOTER === */
.app-footer {
    text-align: center;
    padding: 20px 16px;
    font-size: 12px;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    margin-top: 40px;
}
.app-footer a { color: var(--text-secondary); }

/* === RESPONSIVE === */
@media (min-width: 768px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .container { padding: 24px; }
    .stat-card .stat-value { font-size: 32px; }
    .approval-bar { padding: 16px 24px; }

    .post-card .post-title { font-size: 15px; }
}

@media (max-width: 600px) {
    .calendar-grid { font-size: 11px; }
    .calendar-day { min-height: 60px; padding: 4px; }
    .post-dot { font-size: 9px; }
    .approval-bar { flex-direction: column; align-items: stretch; }
    .approval-bar .approval-actions { justify-content: center; }
}
