/* ========================================================
   Norte Sul Saúde — Folha de Estilo Administrativa
   Aesthetics: Sophisticated, Modern, Clean & High-Tech
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --color-admin-bg: #f8fafc;
    --color-sidebar: #0f172a;
    --color-sidebar-active: #1e293b;
    --color-primary: #0f52ba;
    --color-accent: #0df5c4;
    --color-dark: #03182b;
    --color-border: #e2e8f0;
    --color-card-bg: #ffffff;
    --color-text: #334155;
    --color-text-light: #ffffff;
    --color-text-muted: #64748b;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    
    --font-admin: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--color-admin-bg);
    color: var(--color-text);
    font-family: var(--font-admin);
    overflow-x: hidden;
    display: flex;
    min-height: 100vh;
}

/* 1. Layout Principal do Admin */
.admin-wrapper {
    display: flex;
    width: 100%;
}

/* Sidebar Estilizada */
.admin-sidebar {
    width: 260px;
    background-color: var(--color-sidebar);
    color: var(--color-text-light);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: 0.3s;
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-symbol {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-accent), var(--color-primary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    color: #fff;
}

.sidebar-header h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.sidebar-header h3 span {
    display: block;
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--color-accent);
    letter-spacing: 1px;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex-grow: 1;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.7);
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.2s;
}

.sidebar-item.active a, .sidebar-item a:hover {
    background-color: var(--color-sidebar-active);
    color: var(--color-accent);
}

.sidebar-item a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background-color: rgba(0,0,0,0.1);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    background-color: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info span {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.user-info p {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background-color: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: 0.2s;
}

.btn-logout:hover {
    background-color: var(--color-danger);
    color: #fff;
    border-color: transparent;
}

/* Área de Conteúdo */
.admin-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-navbar {
    height: 70px;
    background-color: #fff;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
}

.navbar-brand h4 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--color-dark);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-view-site {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: var(--color-admin-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

.btn-view-site:hover {
    background-color: var(--color-dark);
    color: #fff;
}

.admin-main-container {
    padding: 30px;
    flex-grow: 1;
    overflow-y: auto;
}

/* 2. Componentes de Dashboard */
.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 36px;
}

.admin-stat-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-card-details span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-details h3 {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--color-dark);
    margin-top: 4px;
}

.stat-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background-color: rgba(15, 82, 186, 0.06);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.admin-stat-card:nth-child(2) .stat-card-icon {
    background-color: rgba(13, 245, 196, 0.08);
    color: #0c9c7f;
}

.admin-stat-card:nth-child(3) .stat-card-icon {
    background-color: rgba(245, 158, 11, 0.08);
    color: var(--color-warning);
}

.admin-stat-card:nth-child(4) .stat-card-icon {
    background-color: rgba(239, 68, 68, 0.08);
    color: var(--color-danger);
}

/* Tabelas e Paineis Administrativos */
.admin-card {
    background-color: #fff;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    overflow: hidden;
}

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

.card-header h5 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-dark);
}

.card-body {
    padding: 24px;
}

/* Tabelas Limpas */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th {
    padding: 14px 20px;
    background-color: #f8fafc;
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.admin-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.88rem;
    color: var(--color-text);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

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

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

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

/* Formulários Admin */
.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}

.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-dark);
    margin-bottom: 8px;
    display: block;
}

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

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(15, 82, 186, 0.15);
}

.form-help {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* Botões */
.btn-admin {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    transition: 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background-color: #0b3f94;
}

.btn-secondary {
    background-color: #e2e8f0;
    color: var(--color-text);
}

.btn-secondary:hover {
    background-color: #cbd5e1;
}

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

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

/* 3. Módulo Especial: SuperSEO Inteligente */
.seo-analyzer-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 30px;
}

.seo-metrics-card {
    background-color: #f8fafc;
    border: 1px dashed var(--color-border);
    border-radius: 8px;
    padding: 20px;
}

.score-meter-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.score-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: bold;
    font-family: var(--font-heading);
    color: var(--color-dark);
}

.score-circle.excellent { background-color: rgba(16, 185, 129, 0.1); color: var(--color-success); border: 2px solid var(--color-success); }
.score-circle.good { background-color: rgba(245, 158, 11, 0.1); color: var(--color-warning); border: 2px solid var(--color-warning); }
.score-circle.poor { background-color: rgba(239, 68, 68, 0.1); color: var(--color-danger); border: 2px solid var(--color-danger); }

.score-text h6 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
}

.score-text p {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.seo-tips-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.seo-tip-item {
    display: flex;
    gap: 10px;
    font-size: 0.82rem;
    align-items: flex-start;
}

.seo-tip-item svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.seo-tip-item.valid svg { color: var(--color-success); }
.seo-tip-item.warning svg { color: var(--color-warning); }
.seo-tip-item.invalid svg { color: var(--color-danger); }

/* Google Preview Box */
.google-preview-box {
    background-color: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    font-family: Arial, sans-serif;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.preview-url {
    color: #202124;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.preview-title {
    color: #1a0dab;
    font-size: 19px;
    font-weight: 400;
    line-height: 1.3;
    margin-bottom: 4px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-title:hover {
    text-decoration: underline;
}

.preview-desc {
    color: #4d5156;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

/* 4. Imagens Uploads Grid */
.uploads-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 16px;
}

.gallery-item {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
}

.gallery-item-img {
    width: 100%;
    height: 100px;
    background-size: cover;
    background-position: center;
}

.gallery-item-desc {
    padding: 8px;
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text-muted);
    text-align: center;
}

/* ========================================================
   6. Custom Premium Collapsible Sidebar & Responsiveness
   ======================================================== */

/* Toggle Button Styling */
.admin-sidebar-toggle {
    background: none;
    border: none;
    color: var(--color-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}
.admin-sidebar-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Base Responsive Grid & Table Styles */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

/* Sidebar Backdrop for Mobile */
.admin-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(3, 24, 43, 0.45);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.admin-sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* Desktop Collapsed Sidebar States */
@media (min-width: 1024px) {
    .admin-wrapper.collapsed .admin-sidebar {
        width: 80px;
    }
    .admin-wrapper.collapsed .admin-sidebar .sidebar-header {
        padding: 16px;
        justify-content: center;
    }
    .admin-wrapper.collapsed .admin-sidebar .sidebar-header h3 {
        display: none !important;
    }
    .admin-wrapper.collapsed .admin-sidebar .sidebar-menu {
        padding: 20px 8px;
    }
    .admin-wrapper.collapsed .admin-sidebar .sidebar-item a {
        justify-content: center;
        padding: 12px;
        font-size: 0 !important;
    }
    .admin-wrapper.collapsed .admin-sidebar .sidebar-item a svg {
        margin: 0 !important;
        width: 20px;
        height: 20px;
    }
    .admin-wrapper.collapsed .admin-sidebar .sidebar-user {
        justify-content: center;
        margin-bottom: 0;
    }
    .admin-wrapper.collapsed .admin-sidebar .sidebar-user .user-info {
        display: none !important;
    }
    .admin-wrapper.collapsed .admin-sidebar .btn-logout {
        font-size: 0 !important;
        padding: 10px;
        justify-content: center;
    }
    .admin-wrapper.collapsed .admin-sidebar .btn-logout svg {
        margin: 0 !important;
        width: 18px;
        height: 18px;
    }
}

/* Unified Responsiveness for Tablets & Laptops (< 1024px) */
@media (max-width: 1023px) {
    .admin-sidebar {
        position: fixed !important;
        left: -260px !important;
        top: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        width: 260px !important;
        z-index: 1000 !important;
        transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 10px 0 35px rgba(0, 0, 0, 0.4) !important;
    }
    .admin-sidebar.open {
        left: 0 !important;
    }
    .admin-sidebar-toggle {
        display: flex !important;
    }
    .admin-main-container {
        padding: 20px !important;
    }
    .dashboard-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }
    .seo-analyzer-container {
        grid-template-columns: 1fr !important;
    }
}

/* Mobile Devices Optimization (< 768px) */
@media (max-width: 767px) {
    .admin-navbar {
        padding: 0 15px !important;
    }
    .navbar-actions {
        gap: 10px !important;
    }
    .btn-admin, .btn-view-site {
        padding: 8px 12px !important;
        font-size: 0.75rem !important;
    }
    .dashboard-stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .admin-form-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }
    .admin-form-grid > div {
        grid-column: span 12 !important;
    }
}
