/* ==========================================
   1. Theme Variables & Reset
   ========================================== */
:root {
    --bg-dark: #07090e;
    --bg-panel: #0d111b;
    --bg-card: rgba(255, 255, 255, 0.02);
    --primary: #facc15;
    --primary-light: #fde047;
    --primary-dark: #eab308;
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(250, 204, 21, 0.25);
    --accent-green: #22c55e;
    --accent-green-bg: rgba(34, 197, 94, 0.1);
    --accent-red: #ef4444;
    --accent-red-bg: rgba(239, 68, 68, 0.1);
    --font: 'Outfit', sans-serif;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --glow: 0 0 20px rgba(250, 204, 21, 0.15);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: var(--font);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(250, 204, 21, 0.03) 0%, transparent 45%),
        radial-gradient(circle at 90% 80%, rgba(250, 204, 21, 0.03) 0%, transparent 45%);
    min-height: 100vh;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ==========================================
   2. Structural Layout
   ========================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

header {
    background: rgba(13, 17, 27, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 70px;
    display: flex;
    align-items: center;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
}

/* ==========================================
   3. Common Components
   ========================================== */
.btn {
    padding: 10px 24px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-dark) 100%);
    color: var(--bg-dark);
    box-shadow: 0 4px 15px rgba(250, 204, 21, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(250, 204, 21, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-muted);
}

.btn-danger {
    background: var(--accent-red-bg);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--accent-red);
    color: white;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
    border-radius: 6px;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-success {
    background: var(--accent-green-bg);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-warning {
    background: rgba(24a, 204, 21, 0.1);
    color: var(--primary);
    border: 1px solid rgba(250, 204, 21, 0.2);
}

/* Toast Messages */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(20px);
    opacity: 0;
    animation: slideUp 0.3s forwards cubic-bezier(0.25, 0.8, 0.25, 1);
    transition: var(--transition);
}

.toast-success {
    border-left: 4px solid var(--accent-green);
}

.toast-error {
    border-left: 4px solid var(--accent-red);
}

@keyframes slideUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Form Styling */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.input-control {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--text-main);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: var(--transition);
    width: 100%;
}

.input-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.1);
    background: rgba(255, 255, 255, 0.04);
}

/* ==========================================
   4. Login Portal (Strictly No Admin terms)
   ========================================== */
.login-wrapper {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.login-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--primary-light), var(--primary-dark));
}

.login-title {
    font-size: 2.2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 30px;
    letter-spacing: -0.5px;
}

/* ==========================================
   5. Management Dashboard View
   ========================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 30px;
    margin-top: 30px;
    padding-bottom: 60px;
}

.dashboard-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.panel-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Custom Rich Text Editor */
.editor-toolbar {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-bottom: none;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.editor-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.editor-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.editor-btn.active {
    background: var(--primary);
    color: var(--bg-dark);
}

.rich-editor {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border);
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    min-height: 350px;
    max-height: 600px;
    overflow-y: auto;
    padding: 20px;
    color: var(--text-main);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.7;
    transition: var(--transition);
}

.rich-editor:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.02);
}

.rich-editor h1, .rich-editor h2, .rich-editor h3 {
    margin: 20px 0 10px;
    color: var(--primary);
}

.rich-editor p {
    margin-bottom: 15px;
}

.rich-editor ul, .rich-editor ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

/* Image Upload Container */
.image-upload-wrapper {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.image-upload-wrapper:hover {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.01);
}

.image-preview {
    max-height: 180px;
    max-width: 100%;
    border-radius: 6px;
    margin-top: 15px;
    display: none;
    object-fit: cover;
}

/* SEO Indicator Panels */
.seo-highlight {
    border-left: 3px solid var(--border);
    padding-left: 15px;
}

.seo-highlight.valid {
    border-left-color: var(--accent-green);
}

.seo-card {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.seo-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.seo-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.seo-indicator.pass {
    color: var(--text-main);
}

.seo-icon {
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

.seo-icon.pass {
    background: var(--accent-green-bg);
    color: var(--accent-green);
}

.seo-icon.fail {
    background: var(--accent-red-bg);
    color: var(--accent-red);
}

.char-counter {
    font-size: 0.8rem;
    align-self: flex-end;
    color: var(--text-muted);
}

.char-counter.valid {
    color: var(--accent-green);
}

.char-counter.invalid {
    color: var(--accent-red);
}

/* Blog Database List Section */
.blog-list-panel {
    margin-top: 30px;
    margin-bottom: 60px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    text-align: left;
}

th, td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

td {
    font-size: 0.95rem;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

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

/* ==========================================
   6. Public Blog View Layouts
   ========================================== */
.blogs-hero {
    text-align: center;
    padding: 60px 0 40px;
}

.blogs-hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.blogs-hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Dynamic Cards Grid */
.blogs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    padding-bottom: 80px;
}

.blog-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.blog-card:hover {
    transform: translateY(-5px);
    border-color: var(--border-hover);
    box-shadow: var(--glow);
}

.card-img-wrapper {
    height: 200px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    background: #111827;
    position: relative;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.blog-card:hover .card-img {
    transform: scale(1.04);
}

.card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-meta {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.4;
}

.card-desc {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 15px;
    margin-top: auto;
}

.read-btn {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition);
}

.read-btn:hover {
    letter-spacing: 0.5px;
}

/* ==========================================
   7. Blog Reader Page
   ========================================== */
.reader-wrapper {
    max-width: 800px;
    margin: 40px auto 80px;
    padding: 0 20px;
}

.reader-back {
    margin-bottom: 30px;
}

.reader-header {
    margin-bottom: 35px;
}

.reader-meta {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.reader-title {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 15px;
}

.reader-img-wrapper {
    width: 100%;
    max-height: 450px;
    overflow: hidden;
    border-radius: 18px;
    margin-bottom: 40px;
    border: 1px solid var(--border);
    background: #111827;
}

.reader-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.reader-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-main);
}

.reader-content p {
    margin-bottom: 25px;
}

.reader-content h1, .reader-content h2, .reader-content h3 {
    color: var(--primary);
    margin: 40px 0 15px;
    font-weight: 700;
    line-height: 1.3;
}

.reader-content h1 { font-size: 2rem; }
.reader-content h2 { font-size: 1.6rem; }
.reader-content h3 { font-size: 1.3rem; }

.reader-content ul, .reader-content ol {
    margin-left: 30px;
    margin-bottom: 25px;
}

.reader-content li {
    margin-bottom: 8px;
}

.reader-content a {
    color: var(--primary);
    text-decoration: underline;
    transition: var(--transition);
}

.reader-content a:hover {
    color: var(--primary-light);
}

/* Empty View Alert */
.empty-view {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    margin: 40px 0;
}

.empty-view i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

/* ==========================================
   8. Responsive Media Queries
   ========================================== */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .blogs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .blogs-hero h1 {
        font-size: 2.2rem;
    }
    
    .reader-title {
        font-size: 2.2rem;
    }
    
    .blogs-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-panel {
        padding: 20px;
    }
}

@media (max-width: 500px) {
    header {
        height: auto;
        padding: 15px 0;
    }
    
    nav {
        flex-direction: column;
        gap: 15px;
    }
    
    .login-card {
        padding: 25px 20px;
    }
    
    .login-title {
        font-size: 1.8rem;
    }
    
    table, th, td {
        padding: 10px;
    }
    
    .actions-cell {
        flex-direction: column;
        width: 100%;
    }
    
    .actions-cell .btn {
        width: 100%;
        text-align: center;
    }
}
