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

:root {
    --primary-color: #7c3aed;
    --primary-dark: #6d28d9;
    --secondary-color: #0f172a;
    --text-color: #334155;
    --text-light: #64748b;
    --bg-light: #f1f5f9;
    --bg-dark: #1e293b;
    --white: #ffffff;
    --border-color: #e2e8f0;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    --gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    --sidebar-width: 260px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    background: var(--bg-light);
    line-height: 1.6;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-dark);
    color: var(--white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar .logo {
    height: 70px;
    line-height: 70px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    letter-spacing: -0.5px;
}

.sidebar .logo span {
    background: linear-gradient(135deg, #a855f7 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar nav {
    padding: 20px 0;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    padding: 14px 28px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 15px;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.sidebar nav a i {
    margin-right: 14px;
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.sidebar nav a.active {
    background: rgba(37, 99, 235, 0.2);
    color: var(--white);
    border-left-color: var(--primary-color);
}

.sidebar .sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar .sidebar-footer a {
    display: block;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.sidebar .sidebar-footer a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

/* Main Content */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    background: var(--bg-light);
    min-height: 100vh;
}

.page {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 30px;
}

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

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--secondary-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--gradient);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-warning:hover {
    background: #d97706;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--secondary-color);
    background: var(--bg-light);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table th:first-child {
    border-radius: 10px 0 0 10px;
}

table th:last-child {
    border-radius: 0 10px 10px 0;
}

table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

table tr:hover td {
    background: #f8fafc;
}

table img {
    object-fit: cover;
    border-radius: 8px;
}

.news-admin-summary {
    max-width: 360px;
    max-height: 132px;
    overflow: auto;
    color: var(--text-color);
    line-height: 1.6;
    word-break: break-word;
}

.news-admin-summary img {
    display: block;
    max-width: 140px;
    max-height: 84px;
    width: auto;
    height: auto;
    margin-top: 8px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #dcfce7;
    color: #16a34a;
}

.badge-danger {
    background: #fee2e2;
    color: #dc2626;
}

.badge-warning {
    background: #fef3c7;
    color: #d97706;
}

.badge-primary {
    background: #dbeafe;
    color: #7c3aed;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
    padding-top: 20px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.pagination a:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.pagination .current {
    background: var(--gradient);
    color: var(--white);
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.pagination .disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Form */
.form-container {
    max-width: 700px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: var(--white);
    color: var(--text-color);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-actions {
    margin-top: 30px;
    display: flex;
    gap: 12px;
}

/* Search */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-bar .btn {
    padding: 12px 24px;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 30px;
}

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

.card-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--secondary-color);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.stat-card .icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.stat-card .icon.blue {
    background: #dbeafe;
    color: #7c3aed;
}

.stat-card .icon.green {
    background: #dcfce7;
    color: #22c55e;
}

.stat-card .icon.orange {
    background: #fef3c7;
    color: #f59e0b;
}

.stat-card .icon.red {
    background: #fee2e2;
    color: #ef4444;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--secondary-color);
}

.stat-card .label {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 4px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: all 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--secondary-color);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: var(--bg-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #fee2e2;
    color: var(--danger);
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 80px;
    }
    
    .sidebar .logo {
        font-size: 0;
    }
    
    .sidebar .logo span::first-letter {
        font-size: 20px;
    }
    
    .sidebar nav a span {
        display: none;
    }
    
    .sidebar nav a i {
        margin-right: 0;
    }
    
    .main {
        margin-left: 80px;
    }
    
    .page-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    table {
        font-size: 13px;
    }
    
    table th,
    table td {
        padding: 12px 8px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.sidebar .sidebar-footer .logout {
    margin-top: 10px;
    background: rgba(239, 68, 68, 0.16);
    color: #fecaca;
}

.sidebar .sidebar-footer .logout:hover {
    background: rgba(239, 68, 68, 0.28);
    color: #fff1f2;
}

.admin-login-body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 10%, rgba(168, 85, 247, 0.2) 0, rgba(168, 85, 247, 0) 42%),
        radial-gradient(circle at 85% 90%, rgba(59, 130, 246, 0.22) 0, rgba(59, 130, 246, 0) 40%),
        #f1f5f9;
}

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

.admin-login-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
    padding: 36px;
}

.admin-login-card h1 {
    font-size: 28px;
    color: var(--secondary-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-login-subtitle {
    margin: 0 0 24px;
    color: var(--text-light);
    font-size: 14px;
}

.admin-login-error {
    background: #fee2e2;
    color: #b91c1c;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 18px;
    font-size: 14px;
}

.admin-login-form {
    display: grid;
    gap: 16px;
}

.admin-login-btn {
    width: 100%;
    margin-top: 6px;
    gap: 8px;
}

.admin-login-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
}

.admin-login-home:hover {
    color: var(--primary-color);
}
