* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #FF0F22;
    --secondary-color: #2827E5;
    --text-dark: #1a1a1a;
    --text-light: #666;
    --bg-light: #f8f9fa;
    --white: #ffffff;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
    --sidebar-width: 260px;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
}

/* Login Section */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 20px;
}

.login-box {
    background: var(--white);
    padding: 50px 40px;
    border-radius: 15px;
    box-shadow: var(--shadow-hover);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    width: 120px;
    height: 50px;
    margin-bottom: 30px;
    object-fit: contain;
    background: var(--white);
    padding: 5px;
    border-radius: 10px;
}

.login-box h2 {
    margin-bottom: 30px;
    color: var(--text-dark);
}

.login-box form {
    text-align: left;
}

.login-box .form-group {
    margin-bottom: 25px;
}

.login-box .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.login-box .form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.login-box .form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 15, 34, 0.1);
}

.login-box .btn-primary {
    width: 100%;
    margin-top: 10px;
    padding: 14px 20px;
    justify-content: center;
    font-size: 1rem;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 15px 0;
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.logo {
    width: 120px;
    height: 50px;
    border-radius: 10px;
    background: var(--white);
    padding: 5px;
    object-fit: contain;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.tagline {
    font-size: 0.85rem;
    opacity: 0.95;
}

.header-actions {
    display: flex;
    gap: 15px;
}

.btn-icon,
.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid var(--white);
    color: var(--white);
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-icon:hover,
.btn-logout:hover {
    background: var(--white);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-icon:active,
.btn-logout:active {
    transform: translateY(0);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 80px;
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - 80px);
    background: var(--white);
    box-shadow: var(--shadow);
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 90;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.menu-link:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.menu-link.active {
    background: linear-gradient(90deg, rgba(255, 15, 34, 0.1), transparent);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.menu-link i {
    font-size: 1.2rem;
    width: 25px;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--white);
    padding: 8px;
    margin-right: 10px;
}

.sidebar-toggle i {
    font-size: 1.5rem;
}

.sidebar-toggle:hover {
    color: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: 80px;
    padding: 30px;
    min-height: calc(100vh - 80px);
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-title {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 35px;
    padding-bottom: 18px;
    border-bottom: 3px solid var(--primary-color);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--white);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

#totalVisitsCard {
    cursor: pointer;
    transition: all 0.3s ease;
}

#totalVisitsCard:hover {
    background: linear-gradient(135deg, rgba(255, 15, 34, 0.05), rgba(40, 39, 229, 0.05));
    border: 2px solid rgba(255, 15, 34, 0.2);
}

#totalVisitsCard .stat-info p small {
    display: block;
    margin-top: 5px;
}

.stat-card i {
    font-size: 3rem;
    color: var(--primary-color);
}

.stat-info h3 {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Forms */
.article-form {
    background: var(--white);
    padding: 45px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 28px;
    margin-bottom: 28px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 15, 34, 0.1);
}

.char-count {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 5px;
    text-align: right;
}

.file-input {
    padding: 10px !important;
}

.image-preview {
    margin-top: 15px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    object-fit: contain;
}

.btn-crop {
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(40, 39, 229, 0.3);
}

.btn-crop:hover {
    background: #1a1ab0;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 39, 229, 0.4);
}

.btn-crop:active {
    transform: translateY(0);
}

/* Quill Editor */
#editor {
    height: 400px;
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 8px;
}

.ql-toolbar {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.ql-container {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 20px;
    justify-content: flex-end;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
}

.btn-primary,
.btn-secondary {
    padding: 16px 42px;
    border: none;
    border-radius: 32px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    min-height: 50px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    box-shadow: 0 4px 15px rgba(255, 15, 34, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 25px rgba(255, 15, 34, 0.4);
}

.btn-primary:active {
    transform: translateY(0) scale(1);
}

.btn-secondary {
    background: var(--white);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 15, 34, 0.2);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Tables */
.table-container {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
}

.data-table th {
    padding: 18px 15px;
    text-align: left;
    font-weight: 600;
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background: var(--bg-light);
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 10px 14px;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
}

.action-btn:hover {
    background: var(--bg-light);
    transform: scale(1.1);
}

.action-btn:active {
    transform: scale(1);
}

.action-btn.edit {
    color: var(--secondary-color);
}

.action-btn.delete {
    color: var(--danger);
}

.action-btn.view {
    color: var(--primary-color);
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.pending {
    background: #fff3cd;
    color: #856404;
}

.status-badge.approved {
    background: #d4edda;
    color: #155724;
}

.status-badge.rejected {
    background: #f8d7da;
    color: #721c24;
}

/* Editable Number Inputs for Views & Likes */
.editable-number {
    width: 100px;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--white);
    color: var(--text-dark);
}

.editable-number:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 15, 34, 0.1);
    background: #fff;
}

.editable-number:hover {
    border-color: var(--secondary-color);
}

/* Views & Likes Container */
.views-likes-container {
    background: var(--white);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.bulk-actions {
    margin-bottom: 25px;
}

.bulk-actions h3 {
    color: var(--text-dark);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.bulk-actions p {
    color: var(--text-light);
    margin-bottom: 15px;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Genre Manager */
.genre-manager {
    background: var(--white);
    padding: 45px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.genre-form .form-row {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.genre-form .form-group {
    flex: 1;
    min-width: 200px;
}

.icon-selector-wrapper {
    position: relative;
}

.icon-selector-btn {
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--white);
    color: var(--text-dark);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
}

.icon-selector-btn:hover {
    border-color: var(--primary-color);
    background: rgba(255, 15, 34, 0.05);
}

.icon-preview {
    display: inline-block;
    margin-left: 10px;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.icon-selector {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 5px;
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-hover);
    z-index: 1000;
    max-height: 400px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.icon-selector-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    align-items: center;
}

.icon-selector-header input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
}

.icon-selector-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.icon-selector-close:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    padding: 15px;
    overflow-y: auto;
    max-height: 300px;
}

.icon-option {
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    color: var(--text-dark);
}

.icon-option:hover {
    border-color: var(--primary-color);
    background: rgba(255, 15, 34, 0.1);
    transform: scale(1.1);
}

.icon-option i {
    display: block;
}

.inline-form {
    display: flex;
    gap: 18px;
    margin-bottom: 35px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.inline-form input {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.inline-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.genres-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.genre-item {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    width: 100%;
}

.genre-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.genre-info i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.genre-actions {
    display: flex !important;
    gap: 5px;
    align-items: center;
    flex-shrink: 0;
    visibility: visible !important;
    opacity: 1 !important;
}

.genre-actions .action-btn {
    min-width: 38px;
    min-height: 38px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    visibility: visible !important;
    opacity: 1 !important;
    cursor: pointer;
}

/* Live News */
.live-news-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.live-news-form {
    background: var(--white);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.live-news-form h3 {
    margin-bottom: 20px;
    color: var(--text-dark);
    font-size: 1.3rem;
}

.live-news-list {
    background: var(--white);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.live-news-list h3 {
    margin-bottom: 20px;
    color: var(--text-dark);
    font-size: 1.3rem;
}

.live-news-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.live-news-item {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    transition: all 0.3s ease;
}

.live-news-item:hover {
    box-shadow: var(--shadow);
    transform: translateX(5px);
}

.live-news-content {
    flex: 1;
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 0.95rem;
}

.live-news-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    min-width: 120px;
}

.live-news-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

.live-news-delete {
    background: var(--danger);
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-news-delete:hover {
    background: #c82333;
    transform: scale(1.05);
}

.live-news-delete:active {
    transform: scale(0.95);
}

.live-news-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
    font-style: italic;
}

.live-news-limit-warning {
    background: #fff3cd;
    color: #856404;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #ffc107;
    font-size: 0.9rem;
}

/* Settings */
.settings-container {
    background: var(--white);
    padding: 45px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-width: 800px;
}

.settings-container button {
    margin-top: 30px;
}

.settings-container h3 {
    margin-bottom: 25px;
    color: var(--text-dark);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.crop-modal {
    width: 800px;
}

.view-modal {
    width: 700px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 35px;
    border-bottom: 2px solid var(--border-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 35px;
}

.crop-container {
    padding: 30px;
    background: var(--bg-light);
    max-height: 500px;
}

.modal-actions {
    display: flex;
    gap: 18px;
    justify-content: flex-end;
    padding: 25px 35px;
    border-top: 2px solid var(--border-color);
    margin-top: 10px;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: flex !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: auto !important;
        height: auto !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        color: var(--white) !important;
        padding: 8px !important;
        margin-right: 10px !important;
        z-index: 101 !important;
    }

    .sidebar-toggle i {
        font-size: 1.5rem !important;
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
    }

    .logo-section {
        flex-direction: row;
    }

    .main-content {
        padding: 20px 15px;
    }

    .article-form,
    .genre-manager,
    .settings-container {
        padding: 25px 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 0.9rem;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.5rem;
    }

    .logo {
        width: 100px;
        height: 32px;
    }

    .logo-text h1 {
        font-size: 1.2rem;
    }

    .modal-content {
        max-width: 95%;
    }
}
.additional-images-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.additional-image-item {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
}

.additional-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-additional-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--danger);
    color: var(--white);
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.remove-additional-image:hover {
    transform: scale(1.1);
}

/* Enhanced Mobile Responsive Styles */

/* Sidebar Backdrop/Overlay for Mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 85;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

/* Enhanced Sidebar for Mobile */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: flex !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: auto !important;
        height: auto !important;
        background: transparent !important;
        color: var(--white) !important;
        border: none !important;
        box-shadow: none !important;
        padding: 8px !important;
        margin-right: 10px !important;
        z-index: 101 !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .sidebar-toggle i {
        font-size: 1.5rem !important;
    }

    .sidebar-toggle:active,
    .sidebar-toggle:hover {
        background: transparent !important;
        color: rgba(255, 255, 255, 0.8) !important;
        transform: scale(1.1);
    }

    .main-content {
        margin-left: 0;
        padding: 20px 15px;
    }
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
    /* Header adjustments */
    .header {
        padding: 12px 0;
    }

    .header-content {
        flex-wrap: wrap;
        gap: 12px;
        flex-direction: row;
    }

    .logo-section {
        flex: 1;
        min-width: 0;
    }

    .logo {
        width: 90px;
        height: 40px;
    }

    .logo-text h1 {
        font-size: 1.1rem;
    }

    .tagline {
        font-size: 0.75rem;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
        gap: 10px;
        flex-wrap: wrap;
    }

    .btn-icon,
    .btn-logout {
        padding: 10px 16px;
        font-size: 0.85rem;
        gap: 6px;
        flex: 1;
        min-width: 120px;
    }

    /* Sidebar improvements */
    .sidebar {
        width: 85%;
        max-width: 320px;
        top: 70px;
        height: calc(100vh - 70px);
    }

    .sidebar-menu {
        padding: 10px 0;
    }

    .menu-link {
        padding: 20px 25px;
        gap: 15px;
        font-size: 1.05rem;
        min-height: 60px; /* Better touch target - minimum 44px recommended */
        display: flex;
        align-items: center;
        border-left-width: 5px;
    }

    .menu-link i {
        font-size: 1.4rem;
        width: 32px;
        text-align: center;
    }

    .menu-link span {
        font-weight: 500;
        flex: 1;
    }

    .menu-link:active {
        background: rgba(255, 15, 34, 0.15);
        transform: scale(0.98);
    }

    .sidebar-toggle {
        display: flex !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: auto !important;
        height: auto !important;
        background: transparent !important;
        color: var(--white) !important;
        border: none !important;
        box-shadow: none !important;
        padding: 8px !important;
        margin-right: 10px !important;
        z-index: 101 !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .sidebar-toggle i {
        font-size: 1.4rem !important;
    }

    /* Main content */
    .main-content {
        margin-top: 70px;
        padding: 15px 12px;
    }

    .page-title {
        font-size: 1.6rem;
        margin-bottom: 20px;
        padding-bottom: 12px;
    }

    /* Stats grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 25px;
    }

    .stat-card {
        padding: 20px;
        gap: 15px;
    }

    .stat-card i {
        font-size: 2.5rem;
    }

    .stat-info h3 {
        font-size: 1.5rem;
    }

    /* Forms */
    .article-form,
    .genre-manager,
    .settings-container {
        padding: 20px 15px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .icon-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        padding: 10px;
    }
    
    .icon-option {
        padding: 10px;
        font-size: 1rem;
    }

    .form-actions {
        flex-direction: column;
        gap: 12px;
        margin-top: 25px;
        padding-top: 20px;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        padding: 16px 24px;
        font-size: 1rem;
        min-height: 50px; /* Better touch target */
    }

    /* Tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
    }

    .data-table {
        font-size: 0.85rem;
        min-width: 600px;
    }

    .data-table th,
    .data-table td {
        padding: 12px 8px;
    }

    /* Action buttons */
    .action-btn {
        min-width: 48px;
        min-height: 48px;
        padding: 12px;
        margin-right: 4px;
    }

    /* Modals */
    .modal-content {
        max-width: 95%;
        margin: 10px;
    }

    .modal-header,
    .modal-body,
    .modal-actions {
        padding: 20px 15px;
    }

    .crop-modal,
    .view-modal {
        width: 100%;
        max-width: 100%;
    }

    /* Inline form adjustments */
    .inline-form {
        flex-direction: column;
        gap: 12px;
    }

    .inline-form input {
        min-width: 100%;
    }

    /* Genre list */
    .genres-list {
        grid-template-columns: 1fr;
    }

    /* Live News */
    .live-news-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .live-news-form,
    .live-news-list {
        padding: 20px 15px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .header {
        padding: 10px 0;
    }

    .logo {
        width: 80px;
        height: 35px;
    }

    .logo-text h1 {
        font-size: 1rem;
    }

    .tagline {
        font-size: 0.7rem;
    }

    .btn-icon,
    .btn-logout {
        padding: 9px 14px;
        font-size: 0.8rem;
        min-width: 100px;
    }

    .sidebar {
        width: 90%;
        max-width: 300px;
    }

    .sidebar-toggle {
        display: flex !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: auto !important;
        height: auto !important;
        background: transparent !important;
        color: var(--white) !important;
        border: none !important;
        box-shadow: none !important;
        padding: 8px !important;
        margin-right: 8px !important;
        z-index: 101 !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .sidebar-toggle i {
        font-size: 1.3rem !important;
    }

    .menu-link {
        padding: 18px 20px;
        font-size: 1rem;
        min-height: 56px;
    }

    .menu-link i {
        font-size: 1.3rem;
        width: 30px;
    }

    .main-content {
        padding: 12px 10px;
    }

    .page-title {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }

    .stat-card {
        padding: 18px;
    }

    .stat-card i {
        font-size: 2rem;
    }

    .stat-info h3 {
        font-size: 1.3rem;
    }

    .article-form,
    .genre-manager,
    .settings-container {
        padding: 18px 12px;
    }

    .data-table {
        font-size: 0.8rem;
        min-width: 550px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 6px;
    }

    .action-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        width: 70%;
        max-width: 300px;
    }

    .main-content {
        padding: 15px;
    }

    .header {
        padding: 10px 0;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .menu-link {
        padding: 22px 25px;
        min-height: 64px;
    }

    .menu-link:hover {
        background: var(--bg-light);
    }

    .menu-link:active {
        background: rgba(255, 15, 34, 0.2);
        color: var(--primary-color);
    }

    .sidebar-toggle:active {
        transform: scale(0.92);
        background: var(--primary-color);
        color: var(--white);
    }

    .action-btn:active {
        transform: scale(0.88);
    }

    .btn-primary:active,
    .btn-secondary:active {
        transform: translateY(0) scale(0.98);
    }
}

/* Prevent body scroll when sidebar is open on mobile */
@media (max-width: 1024px) {
    body.sidebar-open {
        overflow: hidden;
    }
    
    /* Ensure toggle button is always visible and accessible */
    .sidebar-toggle {
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
}

/* Additional mobile visibility fix */
@media (max-width: 768px) {
    .sidebar-toggle {
        position: relative !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        display: flex !important;
    }
}
