/* =====================
   Admin Styles
   ===================== */

/* Admin Page Base */
.admin-page {
    direction: ltr;
    text-align: left;
}

.admin-page .navbar {
    direction: ltr;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* =====================
   Admin Login Section
   ===================== */
.admin-login-section {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 20px 60px;
    background: linear-gradient(135deg, var(--off-white) 0%, #f0f4ff 100%);
}

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

.admin-login-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 56, 184, 0.1);
    overflow: hidden;
    border: 1px solid rgba(0, 56, 184, 0.08);
}

.admin-login-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    padding: 2.5rem 2rem;
    text-align: center;
    color: white;
}

.admin-login-header .admin-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.admin-login-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.admin-login-header p {
    opacity: 0.9;
    font-size: 1rem;
}

.admin-login-content {
    padding: 2rem;
}

.login-status {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-message {
    color: var(--gray-600);
}

.admin-login-btn {
    width: 100%;
    justify-content: center;
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.user-info {
    text-align: center;
}

.welcome-text {
    font-size: 1.1rem;
    color: var(--charcoal);
    margin-bottom: 1.5rem;
}

.welcome-text span {
    font-weight: 600;
    color: var(--primary-blue);
}

.user-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-actions .btn {
    width: 100%;
    justify-content: center;
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
    color: #dc2626;
}

.admin-login-footer {
    background: var(--off-white);
    padding: 1rem 2rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray-500);
    border-top: 1px solid rgba(0, 56, 184, 0.08);
}

/* =====================
   Admin Dashboard
   ===================== */
.admin-dashboard-section {
    padding: 120px 0 60px;
    min-height: 100vh;
    background: var(--off-white);
}

/* Auth Check & Loading */
.auth-check,
.not-authorized {
    text-align: center;
    padding: 4rem 2rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 56, 184, 0.2);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-spinner-small {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.not-authorized .error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.not-authorized h2 {
    color: var(--charcoal);
    margin-bottom: 0.5rem;
}

.not-authorized p {
    color: var(--gray-600);
    margin-bottom: 1.5rem;
}

/* Admin Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-header h1 {
    font-size: 2rem;
    color: var(--charcoal);
    margin-bottom: 0.25rem;
}

.admin-header-info p {
    color: var(--gray-600);
}

.admin-header-info p span {
    color: var(--primary-blue);
    font-weight: 500;
}

/* =====================
   Admin Tabs
   ===================== */
.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: white;
    padding: 0.5rem;
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 20px rgba(0, 56, 184, 0.06);
    border: 1px solid rgba(0, 56, 184, 0.08);
}

.admin-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: var(--gray-600);
    font-size: 1rem;
}

.admin-tab:hover {
    background: var(--off-white);
    color: var(--charcoal);
}

.admin-tab.active {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 56, 184, 0.3);
}

.admin-tab .tab-icon {
    font-size: 1.25rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Admin Stats */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 20px rgba(0, 56, 184, 0.06);
    border: 1px solid rgba(0, 56, 184, 0.08);
}

.stat-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--charcoal);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* =====================
   Admin Section Card
   ===================== */
.admin-section-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 56, 184, 0.06);
    border: 1px solid rgba(0, 56, 184, 0.08);
}

.section-header-admin {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.section-header-admin h2 {
    font-size: 1.5rem;
    color: var(--charcoal);
    margin-bottom: 0.25rem;
}

.section-header-admin p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Content Loading & Empty */
.content-loading,
.content-empty {
    text-align: center;
    padding: 3rem;
}

.content-empty .empty-icon {
    font-size: 4rem;
    opacity: 0.5;
    margin-bottom: 1rem;
}

.content-empty h3 {
    color: var(--charcoal);
    margin-bottom: 0.5rem;
}

.content-empty p {
    color: var(--gray-500);
}

/* Admin Gallery Grid */
.admin-gallery-grid {
    display: grid;
    gap: 1rem;
}

.admin-gallery-item {
    display: grid;
    grid-template-columns: auto 80px 1fr auto;
    align-items: center;
    gap: 1rem;
    background: var(--off-white);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1rem;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    cursor: grab;
}

.admin-gallery-item:hover {
    border-color: var(--primary-blue);
    background: white;
}

.admin-gallery-item.dragging {
    opacity: 0.5;
    border-color: var(--primary-gold);
    background: #fff9e6;
}

.item-drag-handle {
    color: var(--gray-400);
    font-size: 1.25rem;
    cursor: grab;
    user-select: none;
}

.item-image {
    width: 80px;
    height: 60px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--gray-200);
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-info h4 {
    font-size: 1rem;
    color: var(--charcoal);
    margin-bottom: 0.25rem;
}

.item-category {
    font-size: 0.75rem;
    background: var(--primary-blue);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon-action {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: none;
    background: white;
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon-action:hover {
    background: #fef2f2;
    color: #dc2626;
}

.btn-icon-action.edit-btn:hover {
    background: #f0f4ff;
    color: var(--primary-blue);
}

/* Save Order */
.save-order-container {
    margin-top: 1.5rem;
    text-align: right;
}

.save-order-container .btn.has-changes {
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 4px 15px rgba(0, 56, 184, 0.3);
    }

    50% {
        box-shadow: 0 4px 25px rgba(0, 56, 184, 0.5);
    }
}

/* =====================
   Admin List (Events/Updates)
   ===================== */
.admin-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-list-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.25rem;
    background: var(--off-white);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.admin-list-item:hover {
    border-color: var(--primary-blue);
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 56, 184, 0.1);
}

.list-item-badge {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-md);
    min-width: 90px;
    text-align: center;
}

.badge-upcoming {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.badge-past {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.badge-featured {
    background: linear-gradient(135deg, var(--primary-gold) 0%, #d4a024 100%);
    color: #1a1a1a;
}

.badge-news {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.badge-announcement {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.badge-milestone {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.list-item-content h4 {
    font-size: 1.1rem;
    color: var(--charcoal);
    margin-bottom: 0.25rem;
}

.list-item-subtitle {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
    direction: rtl;
    text-align: right;
}

.list-item-meta {
    display: flex;
    gap: 1.25rem;
    font-size: 0.85rem;
    color: var(--gray-500);
}

.list-item-actions {
    display: flex;
    gap: 0.5rem;
}

/* =====================
   Modals
   ===================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}

.modal-content.modal-small {
    max-width: 400px;
}

.modal-content.modal-large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(0, 56, 184, 0.1);
}

.modal-header h2 {
    font-size: 1.25rem;
    color: var(--charcoal);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--off-white);
    color: var(--gray-600);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--charcoal);
}

.modal-body {
    padding: 2rem;
}

/* =====================
   Bilingual Fields
   ===================== */
.bilingual-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.lang-column {
    padding: 1rem;
    background: var(--off-white);
    border-radius: var(--radius-lg);
}

.lang-header {
    font-size: 1rem;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-blue);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Upload Area */
.upload-area {
    border: 2px dashed rgba(0, 56, 184, 0.3);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
    background: var(--off-white);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-blue);
    background: #f0f4ff;
}

.upload-placeholder .upload-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.upload-placeholder p {
    color: var(--charcoal);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.upload-preview {
    position: relative;
}

.upload-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-md);
    object-fit: contain;
}

.remove-image-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #dc2626;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--charcoal);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid rgba(0, 56, 184, 0.2);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 56, 184, 0.1);
}

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

/* Compression Info */
.compression-info {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.compression-info p {
    font-size: 0.875rem;
    color: #166534;
    margin: 0;
}

.compression-info p+p {
    margin-top: 0.25rem;
}

/* Upload Progress */
.upload-progress {
    margin-bottom: 1.25rem;
}

.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-gold));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--gray-600);
    text-align: center;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Delete Modal */
.delete-warning {
    color: var(--charcoal);
    margin-bottom: 0.5rem;
}

.delete-image-title {
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 1.5rem;
}

.btn-danger {
    background: #dc2626;
    color: white;
    border: none;
}

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

/* =====================
   Toast Notifications
   ===================== */
.toast-container {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.toast-success {
    border-left: 4px solid #16a34a;
}

.toast-error {
    border-left: 4px solid #dc2626;
}

.toast-info {
    border-left: 4px solid var(--primary-blue);
}

.toast-icon {
    font-size: 1.25rem;
}

.toast-message {
    color: var(--charcoal);
    font-weight: 500;
}

.toast-fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* =====================
   Admin Footer
   ===================== */
.admin-footer {
    margin-top: auto;
}

.admin-footer .footer-bottom {
    padding: 1.5rem 0;
}

/* =====================
   Responsive Styles
   ===================== */
@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        text-align: center;
    }

    .admin-tabs {
        flex-direction: column;
    }

    .admin-gallery-item {
        grid-template-columns: auto 60px 1fr;
    }

    .item-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--gray-200);
    }

    .admin-list-item {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .list-item-badge {
        justify-self: start;
    }

    .list-item-actions {
        justify-self: end;
    }

    .bilingual-fields {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    .modal-body {
        padding: 1.5rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    .section-header-admin {
        flex-direction: column;
        align-items: stretch;
    }

    .section-header-admin .btn {
        width: 100%;
        justify-content: center;
    }
}