/*
Theme Name: Saudi Gold Price
Theme URI: https://example.com/saudi-gold-theme
Author: Theme Developer
Author URI: https://example.com
Description: قالب متخصص لعرض أسعار الذهب في السعودية مع تحديث فوري وتحويل العملات
Version: 1.0.0
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sa-gold
Domain Path: /languages
Tags: gold, gold-price, saudi-arabia, rtl, responsive, ajax, api
*/

/* ========================================
   BASE STYLES
   ======================================== */

:root {
    /* Exact colors from DesignRefreance/index.html */
    --darkBg: #0b0e11;
    --panelBg: #161a1e;
    --lightPanel: #1e2329;
    --brandGold: #eebc2b;
    --brandSilver: #aab0b6;
    --textMuted: #848e9c;
    --posGreen: #0ecb81;
    --negRed: #f6465d;
    --borderDark: #2b3139;
    
    /* Legacy compatibility */
    --primary-color: #eebc2b;
    --secondary-color: #C5A000;
    --dark-color: #0b0e11;
    --light-color: #161a1e;
    --success-color: #0ecb81;
    --warning-color: #eebc2b;
    --danger-color: #f6465d;
    --text-color: #eaecef;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #eaecef;
    background-color: #0b0e11;
    direction: rtl;
}

/* ========================================
   HEADER STYLES
   ======================================== */

.site-header {
    background: linear-gradient(135deg, var(--dark-color) 0%, #2d2d2d 100%);
    color: #fff;
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: var(--box-shadow);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.site-logo a {
    color: inherit;
    text-decoration: none;
}

.main-navigation ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.main-navigation a {
    color: #fff;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.main-navigation a:hover {
    background-color: var(--primary-color);
    color: var(--dark-color);
}

/* ========================================
   GOLD PRICE DISPLAY
   ======================================== */

.gold-price-section {
    padding: 120px 20px 60px;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
}

.gold-price-container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: var(--dark-color);
    margin-bottom: 2rem;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: var(--primary-color);
    margin: 1rem auto;
    border-radius: 2px;
}

/* Price Cards */
.price-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.price-card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.price-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.price-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.price-card.gold {
    border-top: 4px solid var(--primary-color);
}

.price-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.price-card-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.price-card-title {
    font-size: 1.3rem;
    color: var(--dark-color);
}

.price-card-subtitle {
    font-size: 0.9rem;
    color: #666;
}

/* Price Display */
.price-display {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.price-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--dark-color);
    display: block;
    margin-bottom: 0.5rem;
}

.price-value .currency {
    font-size: 1rem;
    color: #666;
    margin-right: 0.5rem;
}

.price-change {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.price-change.up {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.price-change.down {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.price-change.neutral {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

/* Dual Price (USD + SAR) */
.dual-price {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.price-box {
    text-align: center;
    padding: 1rem;
    background: #fff;
    border-radius: var(--border-radius);
    border: 2px solid #e9ecef;
}

.price-box .label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.price-box .amount {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--dark-color);
}

/* ========================================
   LIVE INDICATOR
   ======================================== */

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.live-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--success-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* ========================================
   UPDATE INFO
   ======================================== */

.update-info {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-top: 1rem;
}

.last-update {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* ========================================
   GOLD TYPES TABLE
   ======================================== */

.gold-types-section {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
}

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

.gold-types-table th,
.gold-types-table td {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
}

.gold-types-table th {
    background: linear-gradient(135deg, var(--dark-color), #2d2d2d);
    color: #fff;
    font-weight: 600;
}

.gold-types-table tr:hover {
    background: #f8f9fa;
}

.gold-karat {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.karat-badge {
    background: var(--primary-color);
    color: var(--dark-color);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* ========================================
   LOADING & ERROR STATES
   ======================================== */

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    text-align: center;
    margin: 1rem 0;
}

.retry-button {
    background: var(--primary-color);
    color: var(--dark-color);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    margin-top: 1rem;
    transition: var(--transition);
}

.retry-button:hover {
    background: var(--secondary-color);
}

/* ========================================
   FOOTER
   ======================================== */

.site-footer {
    background: var(--dark-color);
    color: #fff;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.footer-section p,
.footer-section a {
    color: #ccc;
    text-decoration: none;
    line-height: 1.8;
}

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

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #333;
    color: #999;
    font-size: 0.9rem;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }

    .main-navigation ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    /* Mobile Menu */
    .mobile-menu-btn { display: block !important; }
    .desktop-nav { display: none !important; }
    .desktop-login-btn { display: none !important; }
    .mobile-sidebar .mobile-nav a {
        display: block !important;
        color: #848e9c !important;
        border-bottom: none !important;
        padding: 0.75rem 0 !important;
        position: static !important;
        text-decoration: none !important;
        font-size: 1rem !important;
        border-bottom: 1px solid #2b3139 !important;
    }

    /* Mobile Footer */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
    }
    .footer-col-about {
        grid-column: 1 / -1 !important;
        text-align: center !important;
    }
    .footer-col-company { display: none !important; }
    .footer-col-links { padding-right: 0 !important; }
    .footer-bottom {
        flex-direction: column !important;
        gap: 1rem !important;
        text-align: center !important;
    }

    .gold-price-section {
        padding: 150px 15px 40px;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .price-cards-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .dual-price {
        grid-template-columns: 1fr;
    }

    .price-value {
        font-size: 2rem;
    }

    .gold-types-table {
        font-size: 0.9rem;
    }

    .gold-types-table th,
    .gold-types-table td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .site-logo {
        font-size: 1.2rem;
    }

    .main-navigation a {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .price-card {
        padding: 1.5rem;
    }

    .price-card-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .price-value {
        font-size: 1.8rem;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.price-card {
    animation: fadeIn 0.6s ease forwards;
}

.price-card:nth-child(1) { animation-delay: 0.1s; }
.price-card:nth-child(2) { animation-delay: 0.2s; }
.price-card:nth-child(3) { animation-delay: 0.3s; }
.price-card:nth-child(4) { animation-delay: 0.4s; }

/* ========================================
   ADMIN BAR FIX
   ======================================== */

body.admin-bar .site-header {
    top: 32px;
}

@media (max-width: 782px) {
    body.admin-bar .site-header {
        top: 46px;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.hidden { display: none; }
.visible { display: block; }

/* ========================================
   EXACT DESIGN STYLES FROM REFERENCE
   ======================================== */

/* الزر العائم */
.fab {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    background-color: #eebc2b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(238, 188, 43, 0.3);
    cursor: pointer;
    z-index: 50;
}

/* شريط التمرير */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0b0e11; }
::-webkit-scrollbar-thumb { background: #2b3139; border-radius: 10px; }

/* الجداول */
.data-table th, .data-table td {
    border: 1px solid #2b3139;
    text-align: center;
    padding: 8px 4px;
}
.data-table tr:nth-child(even) { background-color: rgba(255,255,255,0.02); }
.data-table th { background-color: #eebc2b; color: #000; font-weight: 700; }
.data-table th.dark-th { background-color: #1e2329; color: #eebc2b; }

/* الكروت الداخلية (الأسعار المنفصلة) */
.inner-grid-item {
    background: #1e2329;
    border: 1px solid #2b3139;
    border-radius: 6px;
    padding: 6px;
    color: #fff;
}

/* Tailwind-like Utility Classes for Design */
.max-w-\[1200px\] { max-width: 1200px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.text-center { text-align: center; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.font-bold { font-weight: 700; }
.text-white { color: #ffffff; }
.text-black { color: #000000; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-8 { margin-bottom: 2rem; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.bg-brandGold { background-color: #eebc2b; }
.bg-brandSilver { background-color: #aab0b6; }
.bg-panelBg { background-color: #161a1e; }
.bg-lightPanel { background-color: #1e2329; }
.text-brandGold { color: #eebc2b; }
.text-brandSilver { color: #aab0b6; }
.text-textMuted { color: #848e9c; }
.text-posGreen { color: #0ecb81; }
.text-negRed { color: #f6465d; }
.border-borderDark { border-color: #2b3139; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-md { border-radius: 0.375rem; }
.p-5 { padding: 1.25rem; }
.relative { position: relative; }
.absolute { position: absolute; }
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-3 { grid-column: span 3 / span 3; }
.w-1\/2 { width: 50%; }
.text-\[10px\] { font-size: 10px; }
.text-\[11px\] { font-size: 11px; }
.text-\[12px\] { font-size: 12px; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xs { font-size: 0.75rem; }
.font-normal { font-weight: 400; }

/* ========================================
   CALCULATOR MODAL STYLES
   ======================================== */

.calc-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    /* backdrop-filter removed for performance */
}

.calc-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.calc-modal-content {
    background-color: #1e2329;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow: hidden;
    /* box-shadow removed for performance */
    border: 1px solid #2b3139;
}

.calc-modal-header {
    background-color: #161a1e;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2b3139;
}

.calc-modal-header h2 {
    color: #eebc2b;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.calc-close {
    color: #848e9c;
    font-size: 1.5rem;
    cursor: pointer;
    /* transition removed for performance */
}

.calc-close:hover {
    color: #eebc2b;
}

.calc-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 60px);
}

/* Main Tabs */
.calc-main-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.calc-tab-btn {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #2b3139;
    background-color: #161a1e;
    color: #848e9c;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    /* transition removed for performance */
}

.calc-tab-btn.active {
    background-color: #fff;
    color: #000;
    border-color: #fff;
}

/* Sub Tabs */
.calc-sub-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.calc-sub-btn {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid #2b3139;
    background-color: #161a1e;
    color: #848e9c;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    /* transition removed for performance */
}

.calc-sub-btn.active {
    background-color: #aab0b6;
    color: #000;
    border-color: #aab0b6;
}

.calc-sub-btn[data-tab="gold"].active {
    background-color: #eebc2b;
    border-color: #eebc2b;
}

/* Sections */
.calc-section,
.calc-sub-section {
    display: none;
}

.calc-section.active,
.calc-sub-section.active {
    display: block;
}

/* Title & Subtitle */
.calc-title {
    color: #eebc2b;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.calc-title.gold-title {
    color: #eebc2b;
}

.calc-title.silver-title {
    color: #aab0b6;
}

.calc-subtitle {
    color: #848e9c;
    font-size: 0.8rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Karat Rows */
.calc-karat-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.calc-karat-row label {
    color: #eebc2b;
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 60px;
    text-align: right;
}

.calc-karat-row.silver-row label {
    color: #aab0b6;
}

.calc-unit {
    color: #fff;
    font-size: 0.8rem;
    margin-left: auto;
}

.calc-input {
    flex: 1;
    max-width: 140px;
    padding: 0.6rem 0.8rem;
    border: 1px solid #2b3139;
    border-radius: 8px;
    background-color: #fff;
    color: #000;
    font-size: 1rem;
    text-align: left;
    direction: ltr;
}

.calc-input:focus {
    outline: none;
    border-color: #eebc2b;
    /* No transition effects */
}

/* Calculate Button */
.calc-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 1rem;
    /* transition and transform removed for performance */
}

.calc-btn.gold {
    background-color: #eebc2b;
    color: #000;
}

.calc-btn.silver {
    background-color: #aab0b6;
    color: #000;
}

.calc-btn:hover {
    /* transform and box-shadow removed for performance */
    opacity: 0.9;
}

.calc-btn.silver:hover {
    /* box-shadow removed for performance */
    opacity: 0.9;
}

/* Results */
.calc-result {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #161a1e;
    border-radius: 12px;
    border: 1px solid #2b3139;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    color: #848e9c;
    font-size: 0.9rem;
}

.result-row.highlight {
    border-top: 1px solid #2b3139;
    margin-top: 0.5rem;
    padding-top: 1rem;
    font-weight: 700;
}

.gold-amount {
    color: #eebc2b;
    font-size: 1.1rem;
}

.silver-amount {
    color: #aab0b6;
    font-size: 1.1rem;
}

.zakat-amount {
    color: #0ecb81;
    font-size: 1.2rem;
}

/* Responsive */
@media (max-width: 480px) {
    .calc-modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .calc-input {
        max-width: 100px;
    }
}
