/* =====================================================
   المسار الجغرافي لتقنية المعلومات - Admin Panel Styles
===================================================== */

:root {
    --admin-primary: #5bb12f;
    --admin-primary-dark: #479324;
    --admin-secondary: #1b3b6f;
    --admin-bg: #f5f7fa;
    --admin-card: #ffffff;
    --admin-sidebar: #13294a;
    --admin-text: #333;
    --admin-text-muted: #666;
    --admin-border: #e0e0e0;
    --admin-success: #28a745;
    --admin-warning: #ffc107;
    --admin-danger: #dc3545;
    --admin-radius: 8px;
    --admin-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

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

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Cairo', 'Segoe UI', sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
    line-height: 1.6;
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--admin-secondary) 0%, #1a1a1c 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--admin-card);
    border-radius: var(--admin-radius);
    padding: 40px;
    box-shadow: var(--admin-shadow);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    max-width: 180px;
    height: auto;
    margin-bottom: 20px;
}

.login-header h1 {
    font-size: 1.5rem;
    color: var(--admin-secondary);
    margin-bottom: 5px;
}

.login-header p {
    color: var(--admin-text-muted);
    font-size: 0.9rem;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--admin-border);
    border-radius: var(--admin-radius);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--admin-primary);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--admin-primary);
    color: white;
    border: none;
    border-radius: var(--admin-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-login:hover {
    background: var(--admin-primary-dark);
}

/* Password toggle */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-left: 45px;
}

.toggle-password {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--admin-text-muted);
    transition: color 0.3s;
}

.toggle-password:hover {
    color: var(--admin-primary);
}

/* Remember me checkbox */
.remember-group {
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 400;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--admin-primary);
    cursor: pointer;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.login-footer a {
    color: var(--admin-primary);
    text-decoration: none;
}

.alert-error {
    background: #fee;
    color: var(--admin-danger);
    padding: 12px;
    border-radius: var(--admin-radius);
    margin-bottom: 20px;
    text-align: center;
}

/* ==================== ADMIN LAYOUT ==================== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

/* Sidebar */
.admin-sidebar {
    width: 220px;
    background: var(--admin-sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    right: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    height: 32px;
    width: auto;
}

.sidebar-header span {
    font-weight: 600;
    font-size: 0.95rem;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
}

.nav-section {
    padding: 10px 15px 5px;
    font-size: 0.65rem;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    letter-spacing: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    border-right: 3px solid var(--admin-primary);
}

.nav-badge {
    background: var(--admin-danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-right: auto;
    min-width: 18px;
    text-align: center;
}

.nav-section-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 10px 15px;
}

.nav-item.logout {
    color: #ff6b6b;
}

.nav-item.logout:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #ff4444;
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-right: 220px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.admin-header {
    background: var(--admin-card);
    padding: 20px 30px;
    box-shadow: var(--admin-shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-header h1 {
    font-size: 1.5rem;
    color: var(--admin-secondary);
}

.admin-content {
    padding: 30px;
    overflow-x: hidden;
    width: 100%;
}

/* ==================== DASHBOARD ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--admin-card);
    border-radius: var(--admin-radius);
    padding: 25px;
    box-shadow: var(--admin-shadow);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 30px;
    height: 30px;
    fill: white;
}

.stat-icon.products { background: linear-gradient(135deg, #667eea, #764ba2); }
.stat-icon.services { background: linear-gradient(135deg, #11998e, #38ef7d); }
.stat-icon.projects { background: linear-gradient(135deg, #fc4a1a, #f7b733); }
.stat-icon.news { background: linear-gradient(135deg, #ee0979, #ff6a00); }
.stat-icon.messages { background: linear-gradient(135deg, #00b4db, #0083b0); }

.unread-indicator {
    display: block;
    font-size: 0.75rem;
    color: var(--admin-danger);
    margin-top: 4px;
}

.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 992px) {
    .dashboard-row {
        grid-template-columns: 1fr;
    }
}

.type-message { background: #e6f7ff; color: #0083b0; }

.message-item-link {
    text-decoration: none;
    color: inherit;
}

.message-item-link:hover {
    background: var(--admin-bg);
}

.message-item-link.unread {
    background: #f0f9ff;
}

.recent-status.unread {
    background: #fff0f0;
    color: var(--admin-danger);
}

.recent-status.read {
    background: #f0f0f0;
    color: #666;
}

.stat-info {
    flex: 1;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--admin-secondary);
}

.stat-label {
    color: var(--admin-text-muted);
    font-size: 0.9rem;
}

.stat-link {
    width: 100%;
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid var(--admin-border);
    color: var(--admin-primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.dashboard-section {
    background: var(--admin-card);
    border-radius: var(--admin-radius);
    padding: 25px;
    box-shadow: var(--admin-shadow);
    margin-bottom: 30px;
}

.dashboard-section h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--admin-secondary);
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid var(--admin-border);
}

.recent-item:last-child {
    border-bottom: none;
}

.recent-type {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.type-product { background: #f0e6ff; color: #667eea; }
.type-service { background: #e6fff5; color: #11998e; }
.type-project { background: #fff5e6; color: #fc4a1a; }
.type-news { background: #ffe6f0; color: #ee0979; }
.type-general { background: #f0f0f0; color: #666; }

.recent-title {
    flex: 1;
}

.recent-date {
    color: var(--admin-text-muted);
    font-size: 0.85rem;
}

.recent-status {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.recent-status.published { background: #e6ffe6; color: var(--admin-success); }
.recent-status.draft { background: #fff5e6; color: #ff9800; }

.quick-actions {
    background: var(--admin-card);
    border-radius: var(--admin-radius);
    padding: 25px;
    box-shadow: var(--admin-shadow);
}

.quick-actions h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.action-btn {
    padding: 10px 20px;
    background: var(--admin-bg);
    color: var(--admin-text);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    text-decoration: none;
    transition: all 0.3s;
}

.action-btn:hover {
    background: var(--admin-primary);
    color: white;
    border-color: var(--admin-primary);
}

/* ==================== CONTENT LIST ==================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-header h2 {
    font-size: 1.3rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--admin-primary);
    color: white;
    border: none;
    border-radius: var(--admin-radius);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.btn-primary:hover {
    background: var(--admin-primary-dark);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--admin-bg);
    color: var(--admin-text);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: var(--admin-border);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--admin-card);
    border-radius: var(--admin-radius);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    fill: var(--admin-border);
    margin-bottom: 20px;
}

.empty-state p {
    color: var(--admin-text-muted);
    margin-bottom: 20px;
}

.content-table-wrapper {
    background: var(--admin-card);
    border-radius: var(--admin-radius);
    overflow: hidden;
    box-shadow: var(--admin-shadow);
}

.content-table {
    width: 100%;
    border-collapse: collapse;
}

.content-table th,
.content-table td {
    padding: 15px;
    text-align: right;
    border-bottom: 1px solid var(--admin-border);
}

.content-table th {
    background: var(--admin-bg);
    font-weight: 600;
    font-size: 0.9rem;
}

.content-table tbody tr:hover {
    background: #fafafa;
}

.table-thumb {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
}

.table-thumb-placeholder {
    width: 60px;
    height: 45px;
    background: var(--admin-bg);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-thumb-placeholder svg {
    width: 24px;
    height: 24px;
    fill: var(--admin-border);
}

.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.status-badge.published {
    background: #e6ffe6;
    color: var(--admin-success);
}

.status-badge.draft {
    background: #fff5e6;
    color: #ff9800;
}

.status-badge:hover {
    opacity: 0.8;
}

.actions {
    display: flex;
    gap: 8px;
}

.actions .action-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.actions .action-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.actions .action-btn.edit {
    color: var(--admin-primary);
}

.actions .action-btn.delete {
    color: var(--admin-danger);
}

.actions .action-btn:hover {
    background: currentColor;
}

.actions .action-btn:hover svg {
    fill: white;
}

/* ==================== TAGS PAGE - زر الحذف أوضح ==================== */
.tags-page .actions .action-btn {
    width: auto;
    min-width: auto;
    padding: 8px 14px;
    gap: 6px;
}

.tags-page .actions .action-btn.delete {
    color: #fff;
    background: var(--admin-danger);
    border-color: var(--admin-danger);
}

.tags-page .actions .action-btn.delete:hover {
    background: #c82333;
    border-color: #bd2130;
    color: #fff;
}

.tags-page .actions .action-btn.delete svg {
    fill: currentColor;
}

.tags-page .actions .action-btn .action-btn-label {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ==================== CONTENT FORM ==================== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--admin-text-muted);
    text-decoration: none;
    margin-bottom: 20px;
}

.back-link svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.back-link:hover {
    color: var(--admin-primary);
}

.content-form {
    background: var(--admin-card);
    border-radius: var(--admin-radius);
    padding: 30px;
    box-shadow: var(--admin-shadow);
    max-width: 100%;
    overflow: hidden;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    max-width: 100%;
}

.form-section {
    padding: 20px;
    background: var(--admin-bg);
    border-radius: var(--admin-radius);
    overflow: hidden;
    max-width: 100%;
}

.form-section.full-width {
    grid-column: 1 / -1;
    margin-top: 20px;
}

.form-section h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--admin-secondary);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--admin-primary);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    max-width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--admin-border);
    border-radius: var(--admin-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
    background: white;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--admin-primary);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--admin-text-muted);
    font-size: 0.85rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--admin-primary);
}

.images-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.current-image {
    margin-bottom: 15px;
    text-align: center;
}

.current-image img {
    max-width: 200px;
    max-height: 150px;
    object-fit: cover;
    border-radius: var(--admin-radius);
    margin-bottom: 5px;
}

.current-image span {
    display: block;
    font-size: 0.85rem;
    color: var(--admin-text-muted);
}

.current-images-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
    padding: 10px;
    background: var(--admin-card);
    border-radius: var(--admin-radius);
    border: 1px solid var(--admin-border);
}

.current-image-item {
    position: relative;
}

.current-image-item img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.file-icon-preview {
    width: 80px;
    height: 60px;
    background: var(--admin-bg);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border: 1px solid var(--admin-border);
}

.file-icon-preview svg {
    width: 24px;
    height: 24px;
    fill: var(--admin-primary);
    margin-bottom: 2px;
}

.file-icon-preview span {
    font-size: 0.6rem;
    color: var(--admin-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
    text-align: center;
}

.delete-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--admin-danger);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.file-input {
    width: 100%;
    padding: 10px;
    border: 2px dashed var(--admin-border);
    border-radius: var(--admin-radius);
    cursor: pointer;
}

/* New files list */
.new-files-list {
    margin-top: 10px;
}

.new-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    margin-bottom: 6px;
}

.new-file-item svg {
    flex-shrink: 0;
    color: var(--admin-primary);
}

.new-file-name {
    flex: 1;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.new-file-size {
    font-size: 0.8rem;
    color: var(--admin-text-muted);
}

.new-file-remove {
    background: none;
    border: none;
    color: var(--admin-danger);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.new-file-remove:hover {
    color: #a71d2a;
}

.tags-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: white;
    border: 1px solid var(--admin-border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.tag-checkbox:has(input:checked) {
    background: var(--admin-primary);
    color: white;
    border-color: var(--admin-primary);
}

.tag-checkbox input {
    display: none;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--admin-border);
}

/* ==================== TAGS PAGE ==================== */
.add-tag-section {
    background: var(--admin-card);
    border-radius: var(--admin-radius);
    padding: 25px;
    box-shadow: var(--admin-shadow);
    margin-bottom: 30px;
}

.add-tag-section h3 {
    margin-bottom: 20px;
}

.add-tag-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.add-tag-form .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 200px;
}

.tags-list-section {
    background: var(--admin-card);
    border-radius: var(--admin-radius);
    padding: 25px;
    box-shadow: var(--admin-shadow);
}

.tags-list-section h3 {
    margin-bottom: 20px;
}

.type-badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ==================== MOBILE ELEMENTS ==================== */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: var(--admin-radius);
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--admin-secondary);
}

.mobile-menu-btn:hover {
    background: var(--admin-bg);
}

.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    margin-right: auto;
}

.sidebar-close-btn svg {
    width: 20px;
    height: 20px;
    fill: rgba(255, 255, 255, 0.7);
}

.sidebar-close-btn:hover svg {
    fill: white;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .admin-sidebar {
        width: 200px;
    }
    
    .admin-main {
        margin-right: 200px;
    }
}

@media (max-width: 768px) {
    .admin-wrapper {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 260px;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }
    
    .admin-sidebar.open {
        transform: translateX(0);
    }
    
    .admin-sidebar {
        display: flex;
        flex-direction: column;
        max-height: 100vh;
        overflow: hidden;
    }
    
    .sidebar-nav {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }
    
    .sidebar-close-btn {
        display: block;
    }
    
    .admin-main {
        margin-right: 0;
        width: 100%;
        max-width: 100vw;
    }
    
    .mobile-menu-btn {
        display: block;
        flex-shrink: 0;
    }
    
    .admin-header {
        padding: 12px 15px;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .admin-header h1 {
        font-size: 1.1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
    }
    
    .admin-content {
        padding: 12px;
        overflow-x: hidden;
        width: 100%;
    }
    
    .form-grid,
    .images-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .page-header h2 {
        font-size: 1.1rem;
    }
    
    .page-header .btn-primary {
        width: 100%;
        justify-content: center;
    }
    
    .content-form {
        padding: 15px;
    }
    
    .form-section {
        padding: 12px;
    }
    
    .form-section h3 {
        font-size: 1rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 10px 12px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions .btn-primary,
    .form-actions .btn-secondary {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }
    
    .dashboard-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .dashboard-section {
        padding: 15px;
    }
    
    .dashboard-section h2 {
        font-size: 1rem;
    }
    
    .content-table-wrapper {
        overflow-x: auto;
        margin: 0 -12px;
        padding: 0 12px;
        width: calc(100% + 24px);
    }
    
    .content-table {
        min-width: 550px;
    }
    
    .content-table th,
    .content-table td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }
    
    .add-tag-form {
        flex-direction: column;
        gap: 10px;
    }
    
    .add-tag-form .form-group {
        width: 100%;
        min-width: 100%;
    }
    
    .add-tag-section,
    .tags-list-section {
        padding: 15px;
    }
    
    .message-actions-bar {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .message-actions-bar .btn-primary,
    .message-actions-bar .btn-secondary,
    .message-actions-bar .btn-danger {
        flex: 1 1 calc(50% - 4px);
        min-width: calc(50% - 4px);
        justify-content: center;
        padding: 10px;
        font-size: 0.85rem;
    }
    
    .attachments-grid,
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        padding: 15px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
        text-align: center;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        width: 45px;
        height: 45px;
    }
    
    .stat-icon svg {
        width: 22px;
        height: 22px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .back-link {
        font-size: 0.85rem;
        margin-bottom: 15px;
    }
    
    /* Tags */
    .tags-selection {
        gap: 8px;
    }
    
    .tag-checkbox {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    /* Current images grid */
    .current-images-grid {
        gap: 8px;
        padding: 8px;
    }
    
    .current-image-item img,
    .file-icon-preview {
        width: 60px;
        height: 45px;
    }
    
    /* New files list */
    .new-file-item {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    
    .new-file-name {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .admin-header {
        padding: 10px 12px;
    }
    
    .admin-header h1 {
        font-size: 1rem;
    }
    
    .admin-content {
        padding: 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-number {
        font-size: 1.4rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .recent-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 10px 0;
    }
    
    .recent-type {
        font-size: 0.65rem;
        padding: 3px 8px;
    }
    
    .recent-title {
        font-size: 0.9rem;
    }
    
    .recent-date {
        align-self: flex-end;
        font-size: 0.75rem;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .current-images-grid {
        justify-content: flex-start;
    }
    
    .back-link {
        font-size: 0.85rem;
    }
    
    .content-form {
        padding: 12px;
    }
    
    .form-section {
        padding: 10px;
    }
    
    .page-header h2 {
        font-size: 1rem;
    }
    
    .dashboard-section {
        padding: 12px;
    }
    
    .message-actions-bar .btn-primary,
    .message-actions-bar .btn-secondary,
    .message-actions-bar .btn-danger {
        flex: 1 1 100%;
        min-width: 100%;
    }
    
    .login-card {
        padding: 25px 20px;
    }
    
    .login-header h1 {
        font-size: 1.3rem;
    }
}
