/* ═══════════════════════════════════════════════════════
   WP Manager Server — Tema
   Roxo escuro + sidebar, inspirado no app desktop original
   ═══════════════════════════════════════════════════════ */

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

:root {
    --sidebar-bg: #1B1726;
    --sidebar-header: #120E1A;
    --sidebar-width: 220px;
    --bg: #F3F4F6;
    --card-bg: #FFFFFF;
    --text: #1F2937;
    --text-muted: #6B7280;
    --primary: #6D28D9;
    --primary-hover: #5B21B6;
    --primary-light: #EDE9FE;
    --border: #E5E7EB;
    --success: #059669;
    --warning: #D97706;
    --danger: #DC2626;
    --info: #2563EB;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.1);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

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

/* ── Layout ───────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #C9C5D4;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 22px;
    background: var(--sidebar-header);
    border-bottom: 1px solid rgba(255,255,255,.05);
}

.sidebar-logo {
    font-size: 19px;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -0.5px;
}

.sidebar-subtitle {
    font-size: 11px;
    color: #8B8794;
    display: block;
    margin-top: 3px;
}

.sidebar-nav {
    flex: 1;
    padding: 14px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 22px;
    color: #C9C5D4;
    font-size: 13.5px;
    font-weight: 600;
    transition: all .15s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: #252233;
    color: #FFFFFF;
    text-decoration: none;
}

.nav-item.active {
    background: rgba(109,40,217,.15);
    color: #A78BFA;
    border-left-color: #6D28D9;
}

.nav-item.disabled {
    opacity: .4;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-icon { font-size: 16px; width: 24px; text-align: center; }

.sidebar-footer {
    padding: 14px 22px;
    border-top: 1px solid rgba(255,255,255,.05);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.user-name {
    font-size: 12px;
    color: #8B8794;
    font-weight: 500;
}

.logout-link {
    font-size: 11px;
    color: #6D28D9;
    text-decoration: none;
    font-weight: 500;
}

.logout-link:hover {
    color: #A78BFA;
    text-decoration: none;
}

.version { font-size: 10px; color: #5A5666; }

/* ── Main Content ─────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 28px 32px;
    max-width: 1200px;
}

/* ── Page Header ──────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ── Cards ────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
}

/* ── Stats Grid ───────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Table ────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    background: #F9FAFB;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #F9FAFB; }

.table-sm th, .table-sm td { padding: 8px 12px; font-size: 13px; }

.text-muted { color: var(--text-muted); font-size: 13px; }

.actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; }

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
}

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-test { color: var(--info); border-color: var(--info); }
.btn-check { color: var(--warning); border-color: var(--warning); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #FEF2F2; }

/* ── Badges ───────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    white-space: nowrap;
}

.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-info    { background: #DBEAFE; color: #1E40AF; }
.badge-secondary { background: #F3F4F6; color: #374151; }
.badge-cycle   { background: var(--primary-light); color: var(--primary); }
.badge-type    { background: #E0E7FF; color: #4338CA; font-size: 11px; }

/* ── Forms ────────────────────────────────────────────── */
.form-card {
    max-width: 640px;
    padding: 24px;
}

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

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #FFFFFF;
    color: var(--text);
    transition: border-color .15s;
    font-family: var(--font);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(109,40,217,.1);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-error {
    display: block;
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

select.form-control {
    cursor: pointer;
    appearance: auto;
}

/* ── Alerts ───────────────────────────────────────────── */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
}

.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-info    { background: #DBEAFE; color: #1E40AF; border: 1px solid #93C5FD; }
.alert-error   { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }

/* ── Empty State ──────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 16px;
}

/* ── Error Page ───────────────────────────────────────── */
.error-page {
    text-align: center;
    padding: 60px 24px;
}

.error-code {
    font-size: 72px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.error-message {
    font-size: 18px;
    color: var(--text-muted);
    margin: 16px 0 24px;
}

.minimal-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg);
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .sidebar-logo, .sidebar-subtitle, .nav-item span:not(.nav-icon) {
        display: none;
    }
    .nav-item {
        padding: 12px 16px;
        justify-content: center;
    }
    .main-content {
        margin-left: 60px;
        padding: 20px 16px;
    }
    .page-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .actions {
        flex-direction: column;
    }
}

/* ── Toast notifications ──────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    color: #FFF;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    animation: slideIn .3s ease;
    max-width: 400px;
}

.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--info); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
