/* ========================================= */
/* 1. Reset dan Base Styling */
/* ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    background-color: #80d7ba;
    color: #333;
    scroll-behavior: smooth;
}

.wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: #007bff;
    transition: color 0.3s;
}

a:hover {
    color: #0056b3;
}

/* ========================================= */
/* 2. Header & Navigasi Dinamis */
/* ========================================= */
.main-header {
    background-color: #28a745; /* Warna Hijau Khas Madrasah */
    color: white;
    padding: 10px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 50;
    position: sticky;
    top: 0;
}

.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo img {
    height: 40px; /* Ukuran Logo Dinamis yang Diperbaiki */
    width: auto;
    margin-right: 10px;
    border-radius: 50%;
    object-fit: cover;
}

.logo span {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.5em;
    color: #fff;
    white-space: nowrap;
}

.top-menu ul {
    list-style: none;
    display: flex;
    margin: 0;
}

.top-menu li {
    margin-left: 20px;
}

.top-menu a {
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    transition: background-color 0.3s;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.top-menu a:hover, .top-menu a.active {
    background-color: #1e7e34;
    color: #fff;
}

.top-menu a i {
    margin-right: 5px;
}

/* Status Pengguna & Logout */
.user-status {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.welcome-message {
    margin-right: 15px;
    font-size: 0.9em;
    font-weight: 400;
}

.btn-logout {
    background-color: #dc3545;
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
}

.btn-logout:hover {
    background-color: #c82333;
}

/* ========================================= */
/* 3. Dropdown Menu (Jika Digunakan di index.php lama) */
/* ========================================= */
.dropdown {
    position: relative;
    display: inline-block;
}
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #28a745; 
    min-width: 250px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.4); 
    z-index: 100;
    top: 100%;
    left: 0;
    border-radius: 6px; 
    padding: 0; 
    margin-top: 5px; 
    border: 1px solid #1e7e34; 
}
.dropdown-content a {
    color: white !important;
    padding: 12px 18px;
    text-decoration: none;
    display: flex; 
    align-items: center;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2); 
    transition: background-color 0.3s, color 0.3s;
    font-weight: 600; 
    font-size: 1.05em; 
}
.dropdown-content a:hover {
    background-color: #218838;
}
.dropdown-content a:last-child {
    border-bottom: none;
}
.dropdown:hover .dropdown-content {
    display: block;
}
.dropdown > a i.fa-caret-down {
    margin-left: 5px;
    font-size: 0.8em;
}

/* ========================================= */
/* 4. Layout Dashboard 2-Kolom (Baru) */
/* ========================================= */

.dashboard-layout {
    display: flex;
    flex-grow: 1; /* Penting agar layout mengisi ruang vertikal */
    min-height: calc(100vh - 120px); 
    width: 100%;
}

/* Sidebar Kiri */
.sidebar {
    width: 250px;
    background-color: #f8f9fa;
    padding: 20px 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
    flex-shrink: 0; /* Mencegah sidebar menyusut */
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #343a40;
    text-decoration: none;
    font-size: 1.05em;
    border-left: 5px solid transparent;
    transition: all 0.2s;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background-color: #e9ecef;
    border-left-color: #28a745;
    color: #28a745;
    font-weight: 600;
}

.sidebar-menu a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Konten Utama Kanan */
.main-dashboard-content {
    flex-grow: 1;
    padding: 30px;
    background-color: #ffffff;
}

/* ========================================= */
/* 5. Dashboard Grid & Cards */
/* ========================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.summary-card {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: left;
    transition: transform 0.3s;
    position: relative;
    overflow: hidden;
    border-left: 5px solid;
    text-decoration: none !important;
    color: inherit !important;
    cursor: pointer;
    display: block; /* Agar link berfungsi sebagai blok */
}

.summary-card:hover {
    transform: translateY(-5px);
}

.card-icon {
    font-size: 3em;
    position: absolute;
    top: 20px;
    right: 20px;
    opacity: 0.15;
}

.card-value {
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 5px;
    line-height: 1;
}

.card-label {
    font-size: 1em;
    color: #666;
    font-weight: 500;
}

.card-detail {
    font-size: 0.8em;
    margin-top: 5px;
    color: #888;
}

/* Warna Card */
.card-visitors { border-left-color: #17a2b8; color: #17a2b8; }
.card-berita { border-left-color: #007bff; color: #007bff; }
.card-slider { border-left-color: #ffc107; color: #ffc107; }
.card-media { border-left-color: #28aa75; color: #28a745; }
.card-text { border-left-color: #6f42c1; color: #6f42c1; }

.status-active { color: #28a745; font-weight: 700; }
.status-inactive { color: #dc3545; font-weight: 700; }

.warning-box {
    background-color: #fff3cd;
    color: #856404;
    padding: 15px;
    border: 1px solid #ffeeba;
    border-radius: 5px;
    margin-bottom: 20px;
}

/* ========================================= */
/* 6. Konten Umum & Judul */
/* ========================================= */

.main-content {
    padding: 30px;
    flex-grow: 1;
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 2em;
    color: #343a40;
    margin-bottom: 25px;
    border-bottom: 3px solid #f8f9fa;
    padding-bottom: 10px;
    font-weight: 700;
}

.section-title i {
    color: #28a745;
    margin-right: 10px;
}

/* ========================================= */
/* 7. Footer */
/* ========================================= */
.main-footer {
    background-color: #343a40;
    color: #f8f9fa;
    text-align: center;
    padding: 15px 0;
    font-size: 0.9em;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    margin-top: auto; /* Memastikan footer selalu di bawah */
}

/* ========================================= */
/* 8. Styling Admin Forms & Tables */
/* ========================================= */

.admin-section {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.admin-section h3 {
    font-size: 1.5em;
    color: #28a745;
    margin-bottom: 20px;
    border-bottom: 1px dashed #e9ecef;
    padding-bottom: 10px;
}

/* Forms */
form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

label {
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
    color: #495057;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1em;
    transition: border-color 0.3s;
}

input[type="text"]:focus, textarea:focus {
    border-color: #28a745;
    outline: none;
    box-shadow: 0 0 0 0.1rem rgba(40, 167, 69, 0.25);
}

.btn-submit {
    background-color: #28a745;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
    font-size: 1.1em;
    margin-top: 10px;
    width: auto;
    justify-self: start;
}

.btn-submit:hover {
    background-color: #218838;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table th, .data-table td {
    border: 1px solid #dee2e6;
    padding: 12px;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    background-color: #e9ecef;
    font-weight: 600;
    color: #495057;
}

.data-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Action Buttons di Tabel */
.btn-action {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 4px;
    margin-right: 5px;
    font-size: 0.9em;
    font-weight: 500;
    text-align: center;
}

.btn-action.edit {
    background-color: #ffc107;
    color: #333;
}

.btn-action.delete {
    background-color: #dc3545;
    color: white;
}

.btn-action i {
    margin-right: 4px;
}

/* Pesan Status */
.message {
    background-color: #d4edda;
    color: #155724;
    padding: 15px;
    border: 1px solid #c3e6cb;
    border-radius: 5px;
    margin-bottom: 20px;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    margin-bottom: 20px;
}

/* Running Text */
.running-text-bar {
    background-color: #f8f9fa;
    color: #333;
    padding: 5px 0;
    font-size: 0.9em;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    white-space: nowrap;
    overflow: hidden;
}