/* ==========================================================================
   DAGAR FOUNDATION - ADMIN CMS & SEO CONTROL CENTER STYLESHEET
   Crisp, Modern, High-Performance Light Dashboard Design
   ========================================================================== */

:root {
    --adm-bg: #f8fafc;
    --adm-surface: #ffffff;
    --adm-surface-card: #f8fafc;
    --adm-surface-card-hover: #f1f5f9;
    --adm-border: #e2e8f0;
    --adm-border-focus: #1b5e20;
    
    --adm-primary: #1b5e20;
    --adm-primary-hover: #2e7d32;
    --adm-primary-glow: rgba(27, 94, 32, 0.18);
    --adm-accent: #0284c7;
    --adm-warning: #d97706;
    --adm-danger: #dc2626;
    --adm-success: #16a34a;
    
    --adm-text-main: #0f172a;
    --adm-text-muted: #475569;
    --adm-text-dim: #64748b;
    
    --adm-sidebar-width: 260px;
    --adm-header-height: 70px;
    --adm-radius-sm: 8px;
    --adm-radius-md: 14px;
    --adm-radius-lg: 20px;
    
    --adm-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
    --adm-shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.03);
    --adm-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Auth Overlay Screen */
.auth-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 20%, #e8f5e9 0%, #f1f5f9 85%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.auth-card {
    background: #ffffff;
    border: 1px solid var(--adm-border);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
    border-radius: var(--adm-radius-lg);
    width: 100%;
    max-width: 440px;
    padding: 40px;
    text-align: center;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}
.auth-logo img {
    height: 48px;
    width: auto;
}
.auth-logo span {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--adm-text-main);
}
.auth-logo span small {
    color: var(--adm-primary);
    display: block;
    font-size: 0.75rem;
    letter-spacing: 2px;
}

.auth-header h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    font-weight: 700;
}
.auth-header p {
    color: var(--adm-text-muted);
    font-size: 0.9rem;
    margin-bottom: 28px;
}

.auth-form .form-group {
    text-align: left;
    margin-bottom: 20px;
}

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

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.input-with-icon > i:first-child,
.input-with-icon .input-prefix-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--adm-text-dim);
    font-size: 0.95rem;
    pointer-events: none;
    z-index: 2;
}
.input-with-icon input {
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--adm-radius-sm);
    color: var(--adm-text-main);
    padding: 12px 14px 12px 42px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}
.input-with-icon input:focus {
    border-color: var(--adm-primary);
    box-shadow: 0 0 0 3px var(--adm-primary-glow);
    outline: none;
}
.pwd-toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--adm-text-dim);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    z-index: 5;
    padding: 0;
    transition: color 0.2s ease, background 0.2s ease;
}
.pwd-toggle-btn:hover {
    color: var(--adm-primary);
    background: rgba(0, 0, 0, 0.04);
}
.pwd-toggle-btn i {
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    font-size: 1rem;
    color: inherit !important;
    pointer-events: auto !important;
}

.auth-btn {
    width: 100%;
    background: var(--adm-primary);
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    border-radius: var(--adm-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    margin-top: 10px;
}
.auth-btn:hover {
    background: var(--adm-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--adm-primary-glow);
}

.auth-hint {
    margin-top: 24px;
    font-size: 0.8rem;
    color: var(--adm-text-dim);
    padding: 10px;
    background: #f8fafc;
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-sm);
}

/* ==========================================================================
   Admin Layout: Sidebar & Main Content
   ========================================================================== */

.admin-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: var(--adm-sidebar-width);
    background: var(--adm-surface);
    border-right: 1px solid var(--adm-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    height: var(--adm-header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--adm-border);
}
.sidebar-logo-img {
    height: 38px;
    width: auto;
}
.sidebar-logo-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--adm-text-main);
    line-height: 1.2;
}
.sidebar-logo-title span {
    color: var(--adm-primary);
    font-size: 0.7rem;
    display: block;
    letter-spacing: 1.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--adm-text-dim);
    padding: 12px 14px 6px;
}

.sidebar-menu {
    list-style: none;
    margin-bottom: 16px;
}

.menu-item {
    margin-bottom: 4px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--adm-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--adm-radius-sm);
    transition: all 0.2s ease;
    cursor: pointer;
}
.menu-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    color: var(--adm-text-dim);
    transition: color 0.2s;
}
.menu-link:hover {
    color: var(--adm-primary);
    background: #f1f5f9;
}
.menu-link:hover i {
    color: var(--adm-primary);
}
.menu-link.active {
    color: #ffffff;
    background: var(--adm-primary);
    font-weight: 600;
}
.menu-link.active i {
    color: #ffffff;
}
.menu-badge {
    margin-left: auto;
    background: var(--adm-danger);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--adm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.user-profile-summary {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--adm-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}
.user-info-text {
    line-height: 1.2;
}
.user-name {
    font-size: 0.85rem;
    font-weight: 600;
}
.user-role {
    font-size: 0.72rem;
    color: var(--adm-text-dim);
}
.btn-icon-logout {
    background: none;
    border: none;
    color: var(--adm-text-dim);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--adm-radius-sm);
    transition: all 0.2s;
}
.btn-icon-logout:hover {
    color: var(--adm-danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Main Content Area */
.admin-main {
    flex: 1;
    margin-left: var(--adm-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.admin-header {
    height: var(--adm-header-height);
    background: var(--adm-surface);
    border-bottom: 1px solid var(--adm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 90;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: var(--adm-text-main);
    font-size: 1.25rem;
    cursor: pointer;
}
.page-header-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--adm-text-main);
}
.page-header-subtitle {
    font-size: 0.8rem;
    color: var(--adm-text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}
.btn-view-site {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid var(--adm-border);
    color: var(--adm-text-main);
    padding: 8px 16px;
    border-radius: var(--adm-radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-view-site:hover {
    background: #f8fafc;
    border-color: var(--adm-primary);
    color: var(--adm-primary);
}
.btn-primary-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--adm-primary);
    color: #ffffff;
    border: none;
    padding: 8px 18px;
    border-radius: var(--adm-radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary-action:hover {
    background: var(--adm-primary-hover);
    box-shadow: 0 2px 10px var(--adm-primary-glow);
}

/* Views Container */
.admin-content {
    flex: 1;
    padding: 32px;
}

.admin-view {
    display: none;
}
.admin-view.active {
    display: block;
    animation: fadeInView 0.25s ease-in-out;
}

@keyframes fadeInView {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Dashboard Widgets & Metrics
   ========================================================================== */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.metric-card {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-md);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--adm-shadow-sm);
    transition: all 0.2s ease;
}
.metric-card:hover {
    border-color: var(--adm-border-focus);
    transform: translateY(-2px);
}
.metric-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: var(--adm-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.icon-blogs { background: #e0f2fe; color: #0284c7; }
.icon-views { background: #f3e8ff; color: #7e22ce; }
.icon-messages { background: #fef3c7; color: #d97706; }
.icon-subscribers { background: #dcfce7; color: #15803d; }

.metric-details h3 {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.1;
}
.metric-details p {
    font-size: 0.82rem;
    color: var(--adm-text-muted);
    margin-top: 4px;
}

.dashboard-split-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.dash-panel {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-md);
    padding: 24px;
    box-shadow: var(--adm-shadow-sm);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--adm-border);
}
.panel-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
.panel-header a {
    font-size: 0.82rem;
    color: var(--adm-accent);
    text-decoration: none;
}

/* ==========================================================================
   SEO Control Center (Google SERP Previews, Meta Inputs, Schema)
   ========================================================================== */

.seo-page-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    padding: 14px 20px;
    border-radius: var(--adm-radius-md);
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.seo-page-selector label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--adm-text-main);
}
.seo-tab-btn {
    background: #ffffff;
    border: 1px solid var(--adm-border);
    color: var(--adm-text-muted);
    padding: 8px 16px;
    border-radius: var(--adm-radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.seo-tab-btn:hover {
    color: var(--adm-primary);
    border-color: var(--adm-primary);
    background: #f8fafc;
}
.seo-tab-btn.active {
    background: var(--adm-primary);
    border-color: var(--adm-primary);
    color: #ffffff;
}

.seo-manager-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 28px;
}

.seo-form-card {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-md);
    padding: 24px;
}

.seo-preview-card {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-md);
    padding: 24px;
}

/* Google SERP Snippet Preview Box */
.serp-preview-box {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    margin-top: 14px;
    color: #202124;
    font-family: Arial, sans-serif;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.serp-url-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #202124;
    margin-bottom: 4px;
}
.serp-favicon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}
.serp-title {
    font-size: 18px;
    color: #1a0dab;
    line-height: 1.3;
    font-weight: 400;
    margin-bottom: 6px;
    cursor: pointer;
    word-break: break-word;
}
.serp-title:hover {
    text-decoration: underline;
}
.serp-desc {
    font-size: 13px;
    color: #4d5156;
    line-height: 1.5;
    word-break: break-word;
}

/* Social Card Preview */
.social-preview-box {
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 16px;
    background: var(--adm-surface-card);
}
.social-preview-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #000;
}
.social-preview-content {
    padding: 16px;
}
.social-preview-domain {
    font-size: 0.75rem;
    color: var(--adm-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.social-preview-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--adm-text-main);
    margin-bottom: 6px;
}
.social-preview-desc {
    font-size: 0.82rem;
    color: var(--adm-text-muted);
    line-height: 1.4;
}

/* Char counter */
.char-count-badge {
    font-size: 0.75rem;
    color: var(--adm-text-dim);
    float: right;
    margin-top: 4px;
}
.char-count-badge.warning { color: var(--adm-warning); }
.char-count-badge.ok { color: var(--adm-success); }

/* Form Controls */
.form-group {
    margin-bottom: 18px;
}
.form-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--adm-text-main);
    margin-bottom: 6px;
}
.form-input, .form-textarea, .form-select {
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--adm-radius-sm);
    color: var(--adm-text-main);
    padding: 10px 14px;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: var(--adm-primary);
    box-shadow: 0 0 0 3px var(--adm-primary-glow);
    outline: none;
}
.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* ==========================================================================
   Blog Manager & Table
   ========================================================================== */

.table-responsive {
    overflow-x: auto;
}

.adm-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
.adm-table th {
    background: #f8fafc;
    color: var(--adm-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--adm-border);
}
.adm-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--adm-border);
    font-size: 0.88rem;
    vertical-align: middle;
}
.adm-table tbody tr:hover {
    background: #f8fafc;
}

.table-post-title {
    font-weight: 600;
    color: var(--adm-text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}
.post-table-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
}
.status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}
.status-published { background: #dcfce7; color: #15803d; }
.status-draft { background: #fef3c7; color: #b45309; }
.status-unread { background: #fee2e2; color: #b91c1c; }
.status-read { background: #f1f5f9; color: #475569; }

.table-actions {
    display: flex;
    gap: 8px;
}
.btn-action {
    background: #ffffff;
    border: 1px solid var(--adm-border);
    color: var(--adm-text-muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-action:hover {
    color: var(--adm-primary);
    border-color: var(--adm-primary);
    background: #f8fafc;
}
.btn-action.btn-delete:hover {
    color: var(--adm-danger);
    border-color: var(--adm-danger);
    background: #fef2f2;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.adm-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.adm-modal-backdrop.active {
    display: flex;
}

.adm-modal {
    background: #ffffff;
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-lg);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--adm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
}
.modal-close-btn {
    background: none;
    border: none;
    color: var(--adm-text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}
.modal-close-btn:hover { color: var(--adm-text-main); }

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--adm-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Rich text toolbar */
.wysiwyg-toolbar {
    display: flex;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid var(--adm-border);
    border-bottom: none;
    padding: 8px;
    border-radius: var(--adm-radius-sm) var(--adm-radius-sm) 0 0;
    flex-wrap: wrap;
}
.tb-btn {
    background: #ffffff;
    border: 1px solid var(--adm-border);
    color: var(--adm-text-main);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}
.tb-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }

/* Toasts / Notifications */
.adm-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.adm-toast {
    background: #ffffff;
    border: 1px solid var(--adm-border);
    color: var(--adm-text-main);
    padding: 14px 20px;
    border-radius: var(--adm-radius-sm);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    animation: toastSlideIn 0.3s ease;
}
.adm-toast.success { border-left: 4px solid var(--adm-success); }
.adm-toast.error { border-left: 4px solid var(--adm-danger); }
.adm-toast.info { border-left: 4px solid var(--adm-accent); }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-split-grid,
    .seo-manager-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.open {
        transform: translateX(0);
    }
    .admin-main {
        margin-left: 0;
    }
    .sidebar-toggle-btn {
        display: block;
    }
}
