/*
Theme Name: Coupophone
Theme URI: https://github.com/moustafa-brahimi/coupophone
Description: ثيم ووردبريس عربي وبسيط لعرض الكوبونات والصفقات اليومية. يتميز بواجهة حديثة تدعم الوضع المظلم والبحث الفوري والبطاقات الجذابة.
Version: 1.0.0
Author: Moustafa Brahimi
Author URI: https://github.com/moustafa-brahimi
Text Domain: coupophone
Domain Path: /languages
*/

/* ----------------------------------------------------
   1. Design System & CSS Variables
------------------------------------------------------- */
:root {
    /* Color Palette - Light Mode Default */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --accent-primary: #4f46e5;      /* Indigo */
    --accent-primary-hover: #4338ca;
    --accent-success: #059669;      /* Emerald */
    --accent-success-hover: #047857;
    --accent-danger: #e11d48;       /* Rose */
    --accent-danger-bg: #ffe4e6;
    
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --font-sans: 'Cairo', 'Tajawal', system-ui, -apple-system, sans-serif;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    --max-width: 1200px;
}

/* Dark Mode Overrides */
[data-theme="dark"] {
    --bg-primary: #0b0f19;
    --bg-secondary: #151f32;
    --bg-tertiary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-primary: #6366f1;
    --accent-primary-hover: #4f46e5;
    --accent-success: #10b981;
    --accent-success-hover: #059669;
    --accent-danger: #f43f5e;
    --accent-danger-bg: #2d1d24;
    
    --border-color: #273549;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

/* ----------------------------------------------------
   2. Document Resets & Base Styles
------------------------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    border: none;
    background: none;
    outline: none;
}

/* Container */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ----------------------------------------------------
   3. Header & Navigation
------------------------------------------------------- */
.site-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo span {
    color: var(--text-primary);
}

.main-navigation {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-menu a {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
}

.nav-menu a:hover,
.nav-menu .current-menu-item > a {
    color: var(--accent-primary);
    background-color: var(--bg-tertiary);
}

/* Actions in Header */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Dark Mode Switcher Toggle Button */
.theme-toggle-btn {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    transform: scale(1.05);
}

.theme-toggle-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Light mode icon is shown, dark mode is hidden */
.theme-toggle-btn .sun-icon {
    display: none;
}
[data-theme="dark"] .theme-toggle-btn .moon-icon {
    display: none;
}
[data-theme="dark"] .theme-toggle-btn .sun-icon {
    display: block;
}

/* ----------------------------------------------------
   4. Hero Section
------------------------------------------------------- */
.hero-section {
    background: radial-gradient(circle at 10% 20%, rgba(79, 70, 229, 0.08) 0%, rgba(99, 102, 241, 0.02) 90%);
    padding: 5rem 0 4rem 0;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99,102,241,0.03) 0%, transparent 50%);
    pointer-events: none;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2.5rem auto;
    font-weight: 500;
}

/* Search Form */
.search-container {
    max-width: 580px;
    margin: 0 auto;
    position: relative;
    z-index: 5;
}

.search-form-wrapper {
    display: flex;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 4px;
    box-shadow: var(--shadow-lg);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.search-form-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.search-input {
    flex-grow: 1;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    background: transparent;
    color: var(--text-primary);
    font-weight: 500;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-button {
    background-color: var(--accent-primary);
    color: #ffffff;
    padding: 0 1.75rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color var(--transition-fast);
}

.search-button:hover {
    background-color: var(--accent-primary-hover);
}

.search-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* ----------------------------------------------------
   5. Deals Grid
------------------------------------------------------- */
.deals-container {
    padding: 4rem 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    position: relative;
    padding-bottom: 0.5rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 50px;
    height: 4px;
    background-color: var(--accent-primary);
    border-radius: var(--radius-full);
}

.deals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

/* Deal Card Component */
.deal-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
    position: relative;
}

.deal-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(79, 70, 229, 0.2);
}

/* Card Image Area */
.deal-thumbnail-wrapper {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background-color: var(--bg-tertiary);
}

.deal-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.deal-card:hover .deal-thumbnail {
    transform: scale(1.08);
}

/* Discount Badge */
.discount-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: var(--accent-danger);
    color: #ffffff;
    font-weight: 800;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    box-shadow: var(--shadow-md);
    z-index: 2;
    direction: ltr;
}

/* Coupon Badge */
.coupon-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: var(--accent-primary);
    color: #ffffff;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    box-shadow: var(--shadow-md);
    z-index: 2;
}

/* Card Body Content */
.deal-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.deal-category {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.deal-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8rem; /* Keeps layout aligned */
}

.deal-excerpt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.7rem;
}

/* Pricing Row */
.deal-pricing {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
    margin-bottom: 1rem;
}

.deal-price-current {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent-success);
}

.deal-price-original {
    font-size: 0.95rem;
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Action Buttons Container */
.deal-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    transition: all var(--transition-fast);
    width: 100%;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--accent-primary-hover);
    transform: translateY(-1px);
}

.btn-coupon {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px dashed var(--border-color);
}

.btn-coupon:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background-color: rgba(79, 70, 229, 0.05);
}

/* Empty State */
.no-deals {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
}

.no-deals p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* ----------------------------------------------------
   6. Pagination
------------------------------------------------------- */
.pagination-container {
    margin-top: 3.5rem;
    display: flex;
    justify-content: center;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    list-style: none;
}

.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.page-numbers:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.page-numbers.current {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #ffffff;
}

/* ----------------------------------------------------
   7. Single Post / Deal Details Page
------------------------------------------------------- */
.deal-details-layout {
    padding: 3rem 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
}

@media (min-width: 992px) {
    .deal-details-layout {
        grid-template-columns: 2fr 1fr;
    }
}

.deal-main-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.deal-detail-image-wrapper {
    position: relative;
    max-height: 450px;
    overflow: hidden;
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.deal-detail-image {
    width: 100%;
    height: 100%;
    max-height: 450px;
    object-fit: cover;
}

.deal-detail-body {
    padding: 2.5rem;
}

.deal-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.deal-meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.deal-meta-item svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.deal-detail-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.deal-detail-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.deal-detail-content p {
    margin-bottom: 1.5rem;
}

/* Sidebar Deal Panel */
.deal-sidebar-panel {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    align-self: start;
    position: sticky;
    top: 90px;
}

.sidebar-price-box {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-price-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.sidebar-price-val {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-success);
}

.sidebar-price-val.original {
    font-size: 1.2rem;
    text-decoration: line-through;
    color: var(--text-muted);
}

.discount-calc-badge {
    background-color: var(--accent-danger-bg);
    color: var(--accent-danger);
    padding: 0.35rem 1rem;
    border-radius: var(--radius-full);
    font-weight: 800;
    font-size: 0.95rem;
    display: inline-block;
    text-align: center;
}

/* Coupon Box Code Container */
.coupon-box {
    background-color: var(--bg-tertiary);
    border: 2px dashed var(--accent-primary);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.coupon-box-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.coupon-code-display {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    display: block;
    color: var(--text-primary);
    user-select: all;
    background-color: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.btn-sidebar-deal {
    margin-bottom: 1rem;
}

/* Toast Notification for coupon copy */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 1000;
    opacity: 0;
    transition: all var(--transition-normal);
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    color: var(--accent-success);
    font-weight: 800;
}

/* ----------------------------------------------------
   8. Footer Layout
------------------------------------------------------- */
.site-footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0;
    text-align: center;
    color: var(--text-secondary);
    margin-top: auto;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-primary);
    margin-bottom: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-logo span {
    color: var(--text-primary);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    list-style: none;
    margin-bottom: 1.5rem;
}

.footer-links a:hover {
    color: var(--accent-primary);
}

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

/* ----------------------------------------------------
   9. Responsive Media Queries
------------------------------------------------------- */
@media (max-width: 768px) {
    .site-header .container {
        height: auto;
        padding-top: 1rem;
        padding-bottom: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .main-navigation {
        flex-direction: column;
        width: 100%;
        gap: 1rem;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        gap: 0.5rem;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }
    
    .deals-grid {
        grid-template-columns: 1fr;
    }
    
    .deal-detail-body {
        padding: 1.5rem;
    }
    
    .deal-detail-title {
        font-size: 1.5rem;
    }
}
