/**
 * Hasala API - Frontend Styles
 * أنماط واجهة الزوار
 */

:root {
    --hasala-brand: #158740;
    --hasala-brand-dark: #116d33;
    --hasala-accent: #f39c12;
}

/* ========== عام ========== */
.hasala-error {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    text-align: center;
    margin: 30px 0;
    font-weight: bold;
}

.hasala-btn {
    display: inline-block;
    padding: 12px 30px;
    background: var(--hasala-brand);
    color: white !important;
    text-decoration: none !important;
    border-radius: 6px;
    font-weight: bold;
    transition: all 0.3s;
    text-align: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(21, 135, 64, 0.2);
}

.hasala-btn:hover {
    background: var(--hasala-brand-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(21, 135, 64, 0.3);
}

.hasala-btn.large {
    padding: 15px 40px;
    font-size: 1.1em;
}

/* ========== شبكة البرامج ========== */
.hasala-programs-grid {
    display: grid;
    gap: 30px;
    margin: 40px 0;
}

.hasala-programs-grid.columns-1 { grid-template-columns: 1fr; }
.hasala-programs-grid.columns-2 { grid-template-columns: repeat(2, 1fr); }
.hasala-programs-grid.columns-3 { grid-template-columns: repeat(3, 1fr); }
.hasala-programs-grid.columns-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .hasala-programs-grid.columns-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .hasala-programs-grid { grid-template-columns: 1fr !important; }
}

/* ========== بطاقة البرنامج ========== */
.hasala-program-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: all 0.3s;
    border: 1px solid #eee;
}

.hasala-program-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    border-color: var(--hasala-brand);
}

.hasala-program-card .program-image {
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: #f0f0f0;
}

.hasala-program-card .program-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.hasala-program-card:hover .program-image img {
    transform: scale(1.05);
}

.hasala-program-card .program-content {
    padding: 25px;
}

.hasala-program-card h3 {
    font-size: 1.3em;
    margin: 0 0 12px 0;
    color: #333;
    line-height: 1.4;
    font-weight: 700;
}

.hasala-program-card p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
    min-height: 60px;
    font-size: 0.95em;
}

/* ========== شريط التقدم ========== */
.program-stats {
    margin: 20px 0;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e9ecef;
    border-radius: 20px;
    overflow: hidden;
    margin: 10px 0;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.progress-bar.large {
    height: 16px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--hasala-brand) 0%, #1ea557 100%);
    border-radius: 20px;
    transition: width 1.2s ease-out;
    min-width: 2px;
    box-shadow: 0 2px 4px rgba(21, 135, 64, 0.3);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 100%);
    border-radius: 20px;
}

.amounts {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.amounts .current {
    color: var(--hasala-brand);
    font-weight: bold;
    font-size: 1.1em;
}

.amounts .target {
    color: #666;
}

.progress-percentage {
    text-align: left;
    margin-top: 8px;
}

.progress-percentage span {
    display: inline-block;
    background: var(--hasala-brand);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
}

/* ========== شبكة المنتجات ========== */
.hasala-products-grid {
    display: grid;
    gap: 30px;
    margin: 40px 0;
}

.hasala-products-grid.columns-1 { grid-template-columns: 1fr; }
.hasala-products-grid.columns-2 { grid-template-columns: repeat(2, 1fr); }
.hasala-products-grid.columns-3 { grid-template-columns: repeat(3, 1fr); }
.hasala-products-grid.columns-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .hasala-products-grid.columns-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .hasala-products-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 480px) {
    .hasala-products-grid { grid-template-columns: 1fr !important; }
}

/* ========== بطاقة المنتج ========== */
.hasala-product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: all 0.3s;
    border: 1px solid #eee;
}

.hasala-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    border-color: var(--hasala-brand);
}

.hasala-product-card .product-image {
    width: 100%;
    height: 280px;
    overflow: hidden;
    position: relative;
    background: #f0f0f0;
}

.hasala-product-card .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.hasala-product-card:hover .product-image img {
    transform: scale(1.05);
}

.discount-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #dc3545;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(220, 53, 69, 0.3);
}

.stock-badge {
    position: absolute;
    bottom: 12px;
    left: 12px;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
}

.stock-badge.unlimited {
    background: var(--hasala-brand);
    color: white;
}

.stock-badge.low {
    background: var(--hasala-accent);
    color: #fff;
}

.stock-badge.out {
    background: #6c757d;
    color: white;
}

.hasala-product-card .product-content {
    padding: 20px;
}

.hasala-product-card h3 {
    font-size: 1.2em;
    margin: 0 0 10px 0;
    color: #333;
    line-height: 1.4;
    font-weight: 700;
}

.hasala-product-card p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
    min-height: 45px;
    font-size: 0.95em;
}

/* ========== السعر ========== */
.product-price {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 15px;
}

.product-price .current-price {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--hasala-brand);
}

.product-price .old-price {
    font-size: 1em;
    color: #999;
    text-decoration: line-through;
}

/* ========== برنامج واحد ========== */
.hasala-single-program {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    margin: 40px 0;
    border: 1px solid #eee;
}

.hasala-single-program .program-featured-image {
    width: 100%;
    height: 450px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 30px;
}

.hasala-single-program h2 {
    font-size: 2.2em;
    margin: 0 0 20px 0;
    color: #333;
    line-height: 1.3;
}

.hasala-single-program > p {
    font-size: 1.1em;
    line-height: 1.8;
    color: #555;
    margin-bottom: 30px;
}

/* ========== معلومات التقدم ========== */
.program-progress {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    margin: 30px 0;
    border: 1px solid #eee;
}

.program-stats-large {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.program-stats-large .stat {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #e9ecef;
    transition: all 0.3s;
}

.program-stats-large .stat:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.program-stats-large .label {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
}

.program-stats-large .value {
    display: block;
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
}

.program-stats-large .value.highlighted {
    color: var(--hasala-brand);
    font-size: 1.8em;
}

.program-stats-large .value.percentage {
    color: var(--hasala-accent);
    font-size: 1.8em;
}

.progress-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 25px;
    text-align: center;
}

.progress-info > div {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.progress-info strong {
    font-size: 1.8em;
    color: var(--hasala-brand);
}

.progress-info span {
    color: #777;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .program-stats-large {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .progress-info {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .hasala-single-program {
        padding: 20px;
    }
    
    .hasala-single-program .program-featured-image {
        height: 250px;
    }
    
    .hasala-single-program h2 {
        font-size: 1.6em;
    }
}

/* ========== Animation ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hasala-program-card,
.hasala-product-card {
    animation: fadeInUp 0.5s ease;
}

/* ========== RTL Support ========== */
[dir="rtl"] .hasala-programs-grid,
[dir="rtl"] .hasala-products-grid {
    direction: rtl;
}

/* ========== تحسينات إضافية ========== */
.hasala-program-card .hasala-btn,
.hasala-product-card .hasala-btn {
    width: 100%;
    text-align: center;
}

.hasala-single-program .hasala-btn.large {
    display: inline-block;
    margin-top: 20px;
}
