:root {
    --primary: #673ab7;
    --primary-dark: #512da8;
    --secondary: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --bg-light: #f8f9fa;
    --bg-dark: #121212;
    --card-light: #ffffff;
    --card-dark: #1e1e1e;
    --border-light: #dee2e6;
    --border-dark: #444;
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
    --sidebar-hover: #34495e;
}

body.dark-mode {
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --bg-light: #121212;
    --bg-dark: #000000;
    --card-light: #1e1e1e;
    --card-dark: #2d2d2d;
    --border-light: #444;
    --border-dark: #555;
    --sidebar-bg: #1a2634;
    --sidebar-text: #e0e0e0;
    --sidebar-hover: #233548;
    --primary: #9575cd;
    --primary-dark: #7e57c2;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--card-light);
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1001;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.3s ease;
}

.mobile-header h1 {
    font-size: 1.3rem;
    margin: 0;
    font-weight: 600;
}

.hamburger-menu, .theme-toggle {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: color 0.3s ease;
}

.admin-sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    min-height: 100vh;
    position: fixed;
    z-index: 1000;
    transition: transform 0.3s ease-in-out, background-color 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h3 {
    color: #fff;
    margin: 0;
    font-size: 1.4rem;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.4rem;
    cursor: pointer;
    transition: color 0.2s;
}

.admin-sidebar nav ul {
    list-style: none;
    padding: 1rem 0;
}

.admin-sidebar nav a {
    display: flex;
    align-items: center;
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 1rem 1.5rem;
    transition: background 0.2s ease, color 0.2s ease;
    font-size: 1rem;
    font-weight: 500;
}

.admin-sidebar nav a i {
    margin-right: 1rem;
    width: 20px;
    text-align: center;
}

.admin-sidebar nav a:hover, .admin-sidebar nav a.active {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
}

.admin-content {
    margin-left: 260px;
    padding: 2.5rem;
    width: calc(100% - 260px);
    transition: margin-left 0.3s ease, width 0.3s ease, padding 0.3s ease;
    min-height: 100vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.card {
    background: var(--card-light);
    border-radius: 16px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.05);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.card h2 {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
}

.card p {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
    color: var(--primary);
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.stats-cards .card {
    text-align: center;
}

.admin-form {
    background: var(--card-light);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 6px 12px rgba(0,0,0,0.05);
    margin-bottom: 2.5rem;
    transition: background-color 0.3s ease;
}

.form-group {
    margin-bottom: 1.8rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: var(--card-light);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
    font-size: 0.95rem;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.6rem;
    accent-color: var(--primary);
}

.file-upload {
    position: relative;
}

.file-upload input[type="file"] {
    position: absolute;
    left: -9999px;
}

.file-upload-label {
    display: inline-flex;
    align-items: center;
    padding: 0.9rem 1.8rem;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

.file-upload-label:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.file-upload-label i {
    margin-right: 0.6rem;
}

.help-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.6rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.9rem 1.8rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn i {
    margin-right: 0.6rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.action-buttons {
    display: flex;
    gap: 0.6rem;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.btn-action:hover {
    transform: scale(1.05);
}

.btn-edit {
    background: var(--info);
}

.btn-edit:hover {
    background: #138496;
}

.btn-delete {
    background: var(--danger);
}

.btn-delete:hover {
    background: #bd2130;
}

.btn-enable {
    background: var(--success);
}

.btn-enable:hover {
    background: #1e7e34;
}

.btn-disable {
    background: var(--warning);
    color: var(--dark);
}

.btn-disable:hover {
    background: #e0a800;
}

.table-responsive {
    overflow-x: auto;
    margin-bottom: 2rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-light);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 12px rgba(0,0,0,0.05);
    transition: background-color 0.3s ease;
}

.admin-table th, .admin-table td {
    padding: 1.2rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.admin-table thead {
    background: var(--bg-light);
}

.admin-table th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.85rem;
}

.admin-table tbody tr:nth-child(odd) {
    background-color: rgba(0,0,0,0.02);
}

.admin-table tbody tr:hover {
    background-color: rgba(0,0,0,0.04);
}

.dark-mode .admin-table tbody tr:nth-child(odd) {
    background-color: rgba(255,255,255,0.02);
}

.dark-mode .admin-table tbody tr:hover {
    background-color: rgba(255,255,255,0.04);
}

.thumbnail-img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.status-active, .status-read {
    background-color: rgba(40, 167, 69, 0.15);
    color: #28a745;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-disabled, .status-unread {
    background-color: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.feedback-message {
    padding: 1.2rem;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 10px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.feedback-message:before {
    content: "\f058";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1.2rem;
}

.switch-group {
    display: flex;
    align-items: center;
    margin-bottom: 1.2rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 28px;
    margin-right: 0.8rem;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s ease;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s ease;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.switch-label {
    font-weight: 500;
    font-size: 0.95rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 2rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.category-management {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .category-management {
        grid-template-columns: 1fr;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }
    
    .admin-sidebar {
        transform: translateX(-100%);
    }
    
    .admin-sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: block;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .admin-content {
        margin-left: 0;
        width: 100%;
        padding: 1.5rem;
        padding-top: 5rem;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.2rem;
    }

    .page-header h1 {
        font-size: 1.6rem;
    }
}

@media (max-width: 576px) {
    .admin-form, .card {
        padding: 1.5rem;
        border-radius: 12px;
    }
    
    .admin-table th, .admin-table td {
        padding: 1rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    .thumbnail-img {
        width: 50px;
        height: 50px;
    }
}