/* Root Variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #475569;
    --background-color: #f8fafc;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow-color: rgba(0,0,0,0.1);
    --success-color: #22c55e;
    --warning-color: #eab308;
    --error-color: #ef4444;
    --card-bg: #ffffff;
}

/* Basic Reset and Typography */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    direction: rtl;
    font-family: 'Tajawal', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
}

/* Header & Navigation */
.main-header {
    background: white;
    box-shadow: 0 2px 4px var(--shadow-color);
    margin-bottom: 2rem;
}

.navbar {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    margin-right: 1.5rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: var(--primary-color);
    color: white;
}

/* Layout */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Enhanced Search Section */
.search-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px var(--shadow-color);
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1rem;
    align-items: center;
}

.search-input-group {
    position: relative;
}

.search-input-group i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

.search-input-group input {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.filter-group {
    display: flex;
    gap: 1rem;
}

/* Stats Section */
.stats-section {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.stats-section span {
    color: var(--primary-color);
    font-weight: bold;
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.loading-spinner i {
    margin-left: 0.5rem;
    font-size: 1.5rem;
}

/* Error Message */
.error-message {
    text-align: center;
    padding: 2rem;
    color: #e74c3c;
    background: #fdf3f2;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Banner Section */
/* المقاسات المثالية للصور:
 * العرض: 1920px
 * الارتفاع: 600px
 * النسبة: 16:9
 * الحجم الأقصى للملف: 2MB
 */
.banner-slider {
    height: 500px;
    max-width: 1920px;
    width: 100%;
    margin: 0 auto 2rem;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow-color);
    background-color: #f8f9fa;
    position: relative;
    perspective: 1000px;
}

.banner-slider .slick-list {
    transform-style: preserve-3d;
}

.banner-slider .slick-slide {
    opacity: 0;
    transform: rotateY(90deg);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    backface-visibility: hidden;
}

.banner-slider .slick-active {
    opacity: 1;
    transform: rotateY(0deg);
}

.banner-slider .slick-slide.slick-current + .slick-slide {
    transform: rotateY(-90deg);
}

.banner-slider .slide {
    height: 100%;
    width: 100%;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.banner-slider .slide a {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-slider img {
    width: auto;
    height: 100%;
    max-height: 500px;
    object-fit: scale-down;
}

/* Media Queries للبانر */
@media (max-width: 1200px) {
    .banner-slider {
        height: 400px;
    }
    .banner-slider img {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .banner-slider {
        height: 300px;
    }
    .banner-slider img {
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .banner-slider {
        height: 200px;
    }
    .banner-slider img {
        max-height: 200px;
    }
}

/* Slick Accessibility Overrides */
.slick-slide:not(.slick-active) {
    pointer-events: none;
}

.slick-slide.slick-active {
    pointer-events: all;
}

.slick-prev,
.slick-next {
    z-index: 1;
}

.slick-prev:focus,
.slick-next:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Enhanced Card Styles */
.offers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    padding: 1rem;
}

.offer-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.offer-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.offer-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.offer-card.expired {
    background: rgba(243, 244, 246, 0.9);
    opacity: 0.8;
}

.offer-card.expired img {
    filter: grayscale(100%);
}

.offer-card.expired .offer-content {
    opacity: 0.8;
}

.offer-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.offer-content h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--secondary-color);
    line-height: 1.4;
}

.offer-content p {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.offer-dates {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: #777;
}

/* Enhanced Popup Styles */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.popup-content {
    background: white;
    width: 90%;
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    border-radius: 12px;
    position: relative;
    animation: slideIn 0.3s ease;
}

.popup-content h2 {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.popup .close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    border: none;
    background: none;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
}

.popup .close:hover {
    background: #f0f0f0;
    transform: rotate(90deg);
}

.offer-details {
    margin-bottom: 2rem;
    line-height: 1.6;
}

.attachments {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.attachments h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--secondary-color);
}

.attachments a {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0.5rem;
    background: var(--background-color);
    border-radius: 6px;
    text-decoration: none;
    color: var(--primary-color);
    transition: all 0.2s;
}

.attachments a:hover {
    background: var(--primary-color);
    color: white;
}

/* Enhanced Button Styles */
.btn-primary {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--background-color);
    color: var(--secondary-color);
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* Login Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.login-form {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.5s ease;
}

.login-form h2 {
    color: var(--primary-color);
    margin-bottom: 2rem;
    text-align: center;
    font-size: 1.75rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s;
}

.login-form input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-form button {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.login-form button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* Admin Panel Styles */
.admin-header {
    background: var(--card-bg);
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 4px var(--shadow-color);
    margin-bottom: 2rem;
    border-radius: 0.75rem;
}

.admin-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--background-color);
    border-radius: 0.75rem;
    margin-bottom: 2rem;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--secondary-color);
    font-weight: 500;
    transition: all 0.3s;
}

.tab-button.active {
    background: var(--primary-color);
    color: white;
}

.actions-bar {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.actions-bar button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    background: var(--primary-color);
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.actions-bar button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Enhanced Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .search-section {
        grid-template-columns: 1fr;
    }
    
    .filter-group {
        flex-direction: column;
    }
    
    .offers-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .offer-card img {
        height: 180px;
    }
    
    .popup-content {
        width: 95%;
        margin: 1rem auto;
        padding: 1.5rem;
    }
}
