:root {
    --primary-color: #1e3a8a;
    --primary-hover: #172554;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-soft: #e2e8f0;
    --accent-glow: rgba(37, 99, 235, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius-lg: 16px;
    --radius-md: 12px;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* --- Header Styling --- */
.admin-header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-soft);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-group .logo {
    font-family: 'Orbitron', sans-serif;
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge {
    background: #eff6ff;
    color: var(--primary-color);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #dbeafe;
}

.subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* --- Buttons --- */
.btn-primary-admin {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.7rem 1.4rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary-admin:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border-soft);
    padding: 0.7rem 1.4rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--bg-main);
    border-color: #cbd5e1;
}

/* --- Listing Section --- */
.admin-main {
    padding: 3rem 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.search-admin input {
    background: white;
    border: 1px solid var(--border-soft);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    width: 250px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-admin input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* --- Post Cards --- */
.admin-posts-list {
    display: grid;
    gap: 1.2rem;
}

.admin-post-item {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.admin-post-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: scale(1.005);
}

.post-info-admin h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.4rem 0;
    color: var(--text-main);
}

.post-meta-admin {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.cat-indicator {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    color: #475569;
}

.post-actions-admin {
    display: flex;
    gap: 0.75rem;
}

.btn-action {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-muted);
}

.btn-edit:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: #eff6ff;
    transform: translateY(-2px);
}

.btn-delete:hover {
    color: #ef4444;
    border-color: #fee2e2;
    background: #fef2f2;
    transform: translateY(-2px);
}

/* --- Editor Workspace --- */
.editor-section {
    max-width: 900px;
    margin: 0 auto;
}

.editor-container {
    background: white;
    border-radius: 24px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-md);
    padding: 3rem;
}

.editor-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-soft);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--text-main);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: var(--text-main);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.85rem 1.2rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    background: #fcfcfc;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px var(--accent-glow);
}

/* File Upload */
.file-upload-wrapper {
    position: relative;
    border: 2px dashed var(--border-soft);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    background: #fafafa;
}

.file-upload-wrapper:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.file-preview {
    min-height: 80px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.file-preview img {
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

/* Toolbar & Area Kerja */
.editor-toolbar {
    margin-top: 1rem;
    background: #f8fafc;
    border: 1px solid var(--border-soft);
    border-bottom: none;
    padding: 0.6rem;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.tool-btn {
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: var(--transition);
}

.tool-btn:hover {
    background: white;
    color: var(--primary-color);
    border-color: var(--border-soft);
    box-shadow: var(--shadow-sm);
}

.content-editable {
    min-height: 400px;
    border: 1px solid var(--border-soft);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    padding: 2.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
    background: white;
    color: var(--text-main);
    overflow-y: auto;
}

.content-editable:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Internal Content Elements Styling */
.content-editable p {
    margin-bottom: 1.5rem;
}

.content-editable img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 2rem 0;
    box-shadow: var(--shadow-md);
    display: block;
    cursor: pointer;
    transition: var(--transition);
}

.content-editable img:hover {
    filter: brightness(0.9);
}

.content-editable video {
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    margin: 2rem 0;
    box-shadow: var(--shadow-md);
    display: block;
}

.content-editable .btn-link {
    display: inline-block;
    padding: 0.8rem 1.8rem;
    background: var(--primary-color);
    color: #fff !important;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    margin: 1rem 0;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    transition: var(--transition);
}

.btn-link:hover {
    transform: translateY(-2px);
    background: var(--primary-hover);
}

.video-wrapper {
    position: relative;
    margin: 2rem 0;
}

.content-editable iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 12px;
    border: none;
    box-shadow: var(--shadow-md);
}

.form-actions {
    margin-top: 3rem;
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-soft);
}

/* Modal */
.modal-overlay {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
}

.modal {
    background: white;
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-soft);
}

.btn-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #fee2e2;
    color: #ef4444;
    border: 1px solid #fecaca;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    z-index: 5;
}

.btn-remove:hover {
    background: #fecaca;
}

.modal h3 {
    font-weight: 800;
    font-size: 1.5rem;
    margin-bottom: 2rem;
}


/* --- Premium Admin Responsive --- */

.user-display {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-right: 1rem;
    border-right: 1px solid #ccc;
    padding-right: 1rem;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    z-index: 1001;
}

.menu-toggle span {
    width: 28px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: 0.3s;
}

@media (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }

    .editor-container {
        padding: 2.5rem;
    }
}

@media (max-width: 768px) {
    .admin-header {
        padding: 0.8rem 0;
    }

    .menu-toggle {
        display: flex;
    }

    .header-actions {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 100%;
        height: auto;
        background: white;
        flex-direction: column;
        padding: 2rem;
        gap: 1rem;
        transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
        border-bottom: 1px solid var(--border-soft);
        z-index: 999;
    }

    .header-actions.active {
        left: 0;
    }

    .user-display {
        border-right: none;
        padding-right: 0;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    .header-actions .btn-secondary,
    .header-actions .btn-primary-admin {
        width: 100%;
        justify-content: center;
    }

    .logo-group .logo {
        font-size: 1.2rem;
    }

    .subtitle {
        display: none;
    }

    .admin-main {
        padding: 2rem 1.25rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .search-admin input {
        width: 100%;
    }

    .admin-post-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
        padding: 1.25rem;
    }

    .post-actions-admin {
        width: 100%;
        justify-content: flex-end;
    }

    .editor-container {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .editor-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .form-actions {
        flex-direction: column-reverse;
        gap: 1rem;
    }

    .form-actions .btn-primary-admin,
    .form-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .content-editable {
        padding: 1.5rem;
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .header-actions {
        top: 55px;
    }

    .admin-header .container {
        gap: 10px;
    }

    .admin-post-item {
        border-radius: 12px;
    }

    .post-info-admin h3 {
        font-size: 1.05rem;
    }

    .tool-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
}

.btn-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #fee2e2;
    color: #ef4444;
    border: 1px solid #fecaca;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    z-index: 5;
}

.btn-remove:hover {
    background: #fecaca;
}