/* ===========================================
   Vidhi Legal Services - Admin Panel CSS
   Navy & Gold Design
   =========================================== */

:root {
    --primary: #0a1628;
    --primary-light: #0f2240;
    --primary-lighter: #162d50;
    --accent: #c9a84c;
    --accent-light: #e0c060;
    --accent-dark: #a88830;
    --white: #ffffff;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --sidebar-bg: #0a1628;
    --sidebar-hover: #162d50;
    --text: #1a1a2e;
    --text-secondary: #6c757d;
    --text-muted: #95a5a6;
    --border: #e2e8f0;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --danger-bg: #fff5f5;
    --sidebar-width: 250px;
    --header-height: 60px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
}

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

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

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

/* ===========================================
   LOGIN PAGE
   =========================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a1628 0%, #162d50 50%, #0a1628 100%);
    padding: 20px;
}

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

.login-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px 35px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border: 1px solid rgba(201,168,76,0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo .logo-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
}

.login-logo h1 {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 700;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}

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

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form label i {
    color: var(--accent);
    width: 20px;
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.login-form input:focus {
    border-color: var(--accent);
    outline: none;
}

.login-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.login-footer p {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 5px;
}

.login-footer code {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--accent-dark);
}

/* ===========================================
   ADMIN LAYOUT
   =========================================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ===========================================
   SIDEBAR
   =========================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo .logo-icon { font-size: 1.5rem; }

.sidebar-logo .logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
}

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

.sidebar-nav ul { list-style: none; }

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #a0aec0;
    text-decoration: none;
    gap: 12px;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: var(--sidebar-hover);
    color: var(--white);
}

.sidebar-nav li a.active {
    background: var(--sidebar-hover);
    color: var(--accent);
    border-left-color: var(--accent);
}

.sidebar-nav li a i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #a0aec0;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.logout-link, .view-site-link {
    display: block;
    padding: 8px 0;
    color: #a0aec0;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.logout-link:hover, .view-site-link:hover {
    color: var(--accent);
}

/* ===========================================
   MAIN AREA
   =========================================== */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-bar-admin {
    background: var(--white);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text);
}

.top-bar-title {
    font-weight: 600;
    color: var(--primary);
    font-size: 1rem;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.current-time {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.logout-btn-sm {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.content-wrapper {
    flex: 1;
    padding: 25px;
}

/* ===========================================
   CONTENT AREA
   =========================================== */
.admin-content {
    max-width: 1400px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.page-header h1 i {
    color: var(--accent);
    margin-right: 10px;
}

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

/* ===========================================
   CARDS
   =========================================== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
}

.card-header h3 i {
    color: var(--accent);
    margin-right: 8px;
}

.card-body {
    padding: 20px;
}

/* ===========================================
   DASHBOARD STATS
   =========================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.stat-box {
    text-align: center;
    padding: 15px;
    background: var(--bg);
    border-radius: var(--radius);
}

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

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card .stat-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.stat-card .stat-number {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}

.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: var(--bg);
    border-radius: var(--radius);
    color: var(--text);
    transition: all 0.2s;
}

.quick-link:hover {
    background: var(--accent);
    color: var(--white);
    transform: translateY(-1px);
}

.quick-link i {
    font-size: 1.1rem;
}

/* ===========================================
   TABLES
   =========================================== */
.table-container {
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead {
    background: var(--primary);
    color: var(--white);
}

.data-table thead th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

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

.data-table tbody td {
    padding: 10px 15px;
    vertical-align: middle;
}

.file-link {
    color: var(--primary);
    font-weight: 500;
}

.file-link i {
    font-size: 0.7rem;
    color: var(--accent);
}

.empty-state {
    text-align: center;
    padding: 40px !important;
    color: var(--text-muted);
    font-style: italic;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell form {
    display: inline;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-new { background: #fff3cd; color: #856404; }
.status-contacted { background: #cce5ff; color: #004085; }
.status-closed { background: #d4edda; color: #155724; }

.status-select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
}

/* ===========================================
   BUTTONS
   =========================================== */
.btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-lighter); }

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

.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #c82333; }

.btn-lg {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 25px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 12px 25px;
    font-size: 1rem;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ===========================================
   FORMS
   =========================================== */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    transition: border-color 0.2s;
    background: var(--white);
}

.form-control:focus {
    border-color: var(--accent);
    outline: none;
}

textarea.form-control {
    resize: vertical;
    font-family: 'Courier New', monospace;
    line-height: 1.5;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* ===========================================
   EDITOR LAYOUT
   =========================================== */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
}

.editor-toolbar {
    display: flex;
    gap: 5px;
    padding: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    flex-wrap: wrap;
}

.editor-toolbar button {
    background: none;
    border: 1px solid transparent;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.85rem;
    color: var(--text);
    transition: all 0.2s;
}

.editor-toolbar button:hover {
    background: var(--white);
    border-color: var(--border);
}

.editor-toolbar .sep {
    width: 1px;
    background: var(--border);
    margin: 0 5px;
}

.code-editor {
    border-radius: 0 0 var(--radius) var(--radius) !important;
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
    tab-size: 2;
}

/* ===========================================
   SEO PREVIEW
   =========================================== */
.seo-preview {
    padding: 15px;
    background: #f8f9fa;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.seo-url {
    color: #006621;
    font-size: 0.85rem;
    margin-bottom: 2px;
    word-break: break-all;
}

.seo-title {
    color: #1a0dab;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 3px;
    cursor: pointer;
}

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

.seo-desc {
    color: #545454;
    font-size: 0.85rem;
    line-height: 1.4;
}

/* ===========================================
   HEADINGS LIST
   =========================================== */
.headings-list {
    list-style: none;
}

.headings-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.heading-1 { font-weight: 600; color: var(--primary); }
.heading-2 { padding-left: 15px !important; color: var(--text-secondary); }

/* ===========================================
   PAGE INFO
   =========================================== */
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

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

.info-row span:first-child { color: var(--text-muted); }
.info-row span:last-child { color: var(--text); font-weight: 500; }

/* ===========================================
   BADGES
   =========================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-info { background: #cce5ff; color: #004085; }
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }

/* ===========================================
   ALERTS
   =========================================== */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-success { background: #d4edda; border: 1px solid #c3e6cb; color: #155724; }
.alert-error { background: #f8d7da; border: 1px solid #f5c6cb; color: #721c24; }
.alert-warning { background: #fff3cd; border: 1px solid #ffeeba; color: #856404; }

.alert a { font-weight: 600; color: inherit; text-decoration: underline; }

/* ===========================================
   TOOLBAR & SEARCH
   =========================================== */
.toolbar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex: 1;
    max-width: 500px;
}

.search-box i { color: var(--text-muted); }

.search-box input {
    flex: 1;
    border: none;
    padding: 7px;
    font-size: 0.9rem;
    outline: none;
    background: transparent;
}

.filter-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-select, .filter-date {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

/* ===========================================
   PAGINATION
   =========================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.page-link:hover {
    background: var(--bg);
    border-color: var(--accent);
}

.page-link.active {
    background: var(--accent);
    color: var(--white);
    border-color: var(--accent);
}

/* ===========================================
   MODAL
   =========================================== */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius);
    padding: 0;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    z-index: 2001;
}

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

.modal-header h3 { font-size: 1.1rem; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 20px;
}

/* ===========================================
   INLINE FORMS
   =========================================== */
.inline-form {
    display: inline;
}

/* ===========================================
   SEO TABLE
   =========================================== */
.seo-table td {
    vertical-align: top;
}

.file-col { min-width: 180px; }
.file-url { font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; }

.title-col { min-width: 250px; }
.meta-col { min-width: 300px; }

.seo-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: var(--font);
    transition: border-color 0.2s;
}

.seo-input:focus {
    border-color: var(--accent);
    outline: none;
}

.seo-input.modified {
    border-color: var(--accent);
    background: #fffef5;
}

.seo-title-input { font-weight: 500; }
.seo-meta-input { resize: vertical; }

.char-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
    text-align: right;
}

/* ===========================================
   LEADS TABLE
   =========================================== */
.leads-table td { vertical-align: middle; }

.msg-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
    cursor: help;
}

.date-cell { white-space: nowrap; font-size: 0.85rem; color: var(--text-muted); }

/* ===========================================
   TEXT MISC
   =========================================== */
.text-muted { color: var(--text-muted); }

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 1024px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-toggle { display: block; }
    .mobile-toggle { display: block; }
    
    .main-area {
        margin-left: 0;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-form {
        flex-direction: column;
    }
    
    .search-box {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 15px;
    }
    
    .top-bar-admin {
        padding: 0 15px;
    }
}