/* ═══════════════════════════════════════════════════════════════
   Social Manager Ads — Global Styles
   ═══════════════════════════════════════════════════════════════ */

:root {
    --color-primary: #1a1a2e;
    --color-accent: #4361ee;
    --color-accent-hover: #3a54d4;
    --color-facebook: #1877F2;
    --color-facebook-hover: #166fe5;
    --color-instagram: #E4405F;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-bg: #f8fafc;
    --color-card: #ffffff;
    --color-text: #1e293b;
    --color-text-light: #64748b;
    --color-border: #e2e8f0;
    --color-info-bg: #eff6ff;
    --color-info-border: #4361ee;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* ─── Utility ──────────────────────────────────────────────── */

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    text-decoration: none;
    line-height: 1;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--color-accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    color: #fff;
}

.btn-facebook {
    background: var(--color-facebook);
    color: #fff;
    height: 40px;
    border-radius: 6px;
    font-size: 14px;
    padding: 0 24px;
}

.btn-facebook:hover {
    background: var(--color-facebook-hover);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--color-accent);
    border: 2px solid var(--color-accent);
}

.btn-outline:hover {
    background: var(--color-accent);
    color: #fff;
}

.btn-danger {
    background: var(--color-error);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
    color: #fff;
}

.btn-success {
    background: var(--color-success);
    color: #fff;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ─── Card ─────────────────────────────────────────────────── */

.card {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
}

/* ─── Info Box (permission descriptions) ───────────────────── */

.info-box {
    background: var(--color-info-bg);
    border-left: 4px solid var(--color-info-border);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 16px 20px;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.65;
    color: #1e40af;
}

.info-box strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
    color: #1e3a8a;
}

/* ─── Badge ────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-fb {
    background: #e8f0fe;
    color: var(--color-facebook);
}

.badge-ig {
    background: #fce7f3;
    color: var(--color-instagram);
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ─── Forms ────────────────────────────────────────────────── */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--color-text);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--color-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--font-family);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-accent);
}

/* ─── Navbar ───────────────────────────────────────────────── */

.navbar {
    background: var(--color-primary);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.navbar-brand:hover {
    text-decoration: none;
    color: #fff;
}

.navbar-brand svg {
    width: 28px;
    height: 28px;
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.navbar-links a {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
}

.navbar-links a:hover {
    color: #fff;
    text-decoration: none;
}

/* ─── Footer ───────────────────────────────────────────────── */

.footer {
    background: var(--color-primary);
    color: rgba(255, 255, 255, 0.7);
    padding: 48px 24px 32px;
    margin-top: 80px;
}

.footer-grid {
    max-width: 1140px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 48px;
}

.footer h3 {
    color: #fff;
    font-size: 16px;
    margin-bottom: 16px;
}

.footer p {
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 8px;
}

.footer a {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    display: block;
    margin-bottom: 8px;
    transition: color 0.2s;
    text-decoration: none;
}

.footer a:hover {
    color: #fff;
    text-decoration: none;
}

.footer-bottom {
    max-width: 1140px;
    margin: 32px auto 0;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 13px;
}

/* ─── Hero ─────────────────────────────────────────────────── */

.hero {
    padding: 100px 24px 80px;
    text-align: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, #16213e 100%);
    color: #fff;
}

.hero h1 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.hero .tagline {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.8);
    max-width: 600px;
    margin: 0 auto 32px;
    line-height: 1.6;
}

/* ─── How It Works ─────────────────────────────────────────── */

.steps-section {
    padding: 80px 24px;
}

.steps-section h2 {
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 48px;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
    max-width: 1140px;
    margin: 0 auto;
}

.step-card {
    text-align: center;
    padding: 32px 20px;
}

.step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-accent);
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.step-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.step-card p {
    font-size: 14px;
    color: var(--color-text-light);
}

/* ─── Features ─────────────────────────────────────────────── */

.features-section {
    padding: 80px 24px;
    background: #fff;
}

.features-section h2 {
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 48px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    max-width: 1140px;
    margin: 0 auto;
}

.feature-card {
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    transition: box-shadow 0.3s;
}

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

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--color-info-bg);
    color: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 22px;
}

.feature-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 14px;
    color: var(--color-text-light);
    line-height: 1.6;
}

/* ─── Login Page ───────────────────────────────────────────── */

.login-wrapper {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.login-card h1 {
    font-size: 24px;
    text-align: center;
    margin-bottom: 8px;
}

.login-card .subtitle {
    text-align: center;
    color: var(--color-text-light);
    font-size: 14px;
    margin-bottom: 32px;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--color-text-light);
    font-size: 13px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.login-legal {
    text-align: center;
    font-size: 12px;
    color: var(--color-text-light);
    margin-top: 20px;
    line-height: 1.6;
}

.fb-logo-svg {
    width: 20px;
    height: 20px;
    fill: #fff;
    flex-shrink: 0;
}

/* ─── Dashboard Layout ─────────────────────────────────────── */

.dashboard-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 64px);
}

.sidebar {
    background: #fff;
    border-right: 1px solid var(--color-border);
    padding: 24px 0;
}

.sidebar-user {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 12px;
}

.sidebar-user .user-name {
    font-weight: 700;
    font-size: 15px;
}

.sidebar-user .user-email {
    font-size: 13px;
    color: var(--color-text-light);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--color-bg);
    text-decoration: none;
}

.sidebar-nav a.active {
    background: var(--color-info-bg);
    color: var(--color-accent);
    border-left-color: var(--color-accent);
    font-weight: 600;
}

.sidebar-nav .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.dashboard-main {
    padding: 32px 40px;
    overflow-y: auto;
}

.dashboard-main h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
}

.section-panel {
    display: none;
}

.section-panel.active {
    display: block;
}

/* ─── KPI Cards ────────────────────────────────────────────── */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.kpi-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.kpi-card .kpi-label {
    font-size: 13px;
    color: var(--color-text-light);
    font-weight: 500;
    margin-bottom: 4px;
}

.kpi-card .kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
}

.kpi-card .kpi-sub {
    font-size: 12px;
    color: var(--color-text-light);
    margin-top: 2px;
}

/* ─── Connected Account Cards ──────────────────────────────── */

.account-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.account-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.account-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.account-info h4 {
    font-size: 16px;
    margin-bottom: 2px;
}

.account-info p {
    font-size: 13px;
    color: var(--color-text-light);
}

/* ─── Post Table / Cards ───────────────────────────────────── */

.posts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.post-row {
    display: grid;
    grid-template-columns: 60px 1fr 120px 120px;
    gap: 16px;
    align-items: center;
    padding: 16px;
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.post-thumb {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--color-bg);
}

.post-caption {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-date {
    font-size: 13px;
    color: var(--color-text-light);
}

.post-engagement {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--color-text-light);
}

.post-platforms {
    display: flex;
    gap: 6px;
}

/* ─── Campaign Cards ───────────────────────────────────────── */

.campaign-card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.campaign-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.campaign-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.adset-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.adset-card {
    padding: 16px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.adset-card h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.adset-detail {
    font-size: 13px;
    color: var(--color-text-light);
    margin-bottom: 4px;
}

.ad-list {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

.ad-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 13px;
}

/* ─── Business Assets ──────────────────────────────────────── */

.asset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.asset-card {
    padding: 24px;
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.asset-card h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.asset-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}

.asset-row:last-child {
    border-bottom: none;
}

.asset-label {
    color: var(--color-text-light);
}

/* ─── Image Upload ─────────────────────────────────────────── */

.upload-area {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: var(--color-accent);
    background: var(--color-info-bg);
}

.upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-area .upload-icon {
    font-size: 32px;
    margin-bottom: 8px;
    color: var(--color-text-light);
}

.upload-area p {
    font-size: 14px;
    color: var(--color-text-light);
}

.upload-preview {
    margin-top: 16px;
}

.upload-preview img {
    max-height: 200px;
    border-radius: var(--radius-md);
}

/* ─── Status / Progress ────────────────────────────────────── */

.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-top: 16px;
}

.status-bar.status-publishing {
    background: #fef3c7;
    color: #92400e;
}

.status-bar.status-success {
    background: #d1fae5;
    color: #065f46;
}

.status-bar.status-error {
    background: #fee2e2;
    color: #991b1b;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ─── Table ────────────────────────────────────────────────── */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 13px;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--color-border);
    background: var(--color-bg);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

/* ─── Legal Pages ──────────────────────────────────────────── */

.legal-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.legal-page h1 {
    font-size: 32px;
    margin-bottom: 8px;
}

.legal-page .last-updated {
    color: var(--color-text-light);
    font-size: 14px;
    margin-bottom: 32px;
}

.legal-page h2 {
    font-size: 20px;
    margin-top: 32px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

.legal-page h3 {
    font-size: 16px;
    margin-top: 20px;
    margin-bottom: 8px;
}

.legal-page p,
.legal-page li {
    font-size: 15px;
    line-height: 1.7;
    color: #374151;
    margin-bottom: 12px;
}

.legal-page ul,
.legal-page ol {
    padding-left: 24px;
    margin-bottom: 16px;
}

.legal-page li {
    margin-bottom: 6px;
}

/* ─── Deletion Status ──────────────────────────────────────── */

.deletion-status-card {
    max-width: 560px;
    margin: 80px auto;
    text-align: center;
}

.deletion-status-card .status-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.deletion-status-card h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.deletion-status-card .code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    background: var(--color-bg);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    border: 1px solid var(--color-border);
    display: inline-block;
    margin: 8px 0;
}

.deletion-details {
    text-align: left;
    margin-top: 24px;
}

.deletion-details .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}

/* ─── Responsive ───────────────────────────────────────────── */

@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 220px 1fr;
    }
    .dashboard-main {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 32px;
    }
    .steps-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .features-grid {
        grid-template-columns: 1fr;
    }
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
    .account-cards,
    .adset-list,
    .asset-grid {
        grid-template-columns: 1fr;
    }
    .post-row {
        grid-template-columns: 60px 1fr;
    }
}
