/* ----------------------------------------------------
   نظام التصميم والألوان (Design System)
   ---------------------------------------------------- */
:root {
    --bg-dark: #f8fafc;          /* لون الخلفية الرئيسي - Slate 50 */
    --bg-card: #ffffff;          /* لون بطاقة - أبيض */
    --bg-input: #ffffff;
    --border-color: #e2e8f0;     /* رمادي فاتح للحدود */
    --border-color-hover: #cbd5e1;
    
    /* التدرجات والألوان المميِّزة - سماربكس */
    --accent: #1ca3c4;           /* لون أزرق سيان - Smarpix Corporate Cyan */
    --accent-hover: #15829d;     /* سيان داكن عند التحويم */
    --accent-glow: rgba(28, 163, 196, 0.12);
    --text-primary: #0f172a;     /* كحلي داكن - Slate 900 */
    --text-secondary: #334155;   /* كحلي متوسط - Slate 700 */
    --text-muted: #64748b;       /* رمادي باهت - Slate 500 */
    
    /* ألوان الحالة */
    --success: #10b981;          /* أخضر للتوافق */
    --warning: #f59e0b;          /* برتقالي مصفر للتنبيهات */
    --danger: #ef4444;           /* أحمر للتحذيرات الخطيرة */
    --info-blue: #0284c7;        /* أزرق للمعلومات */

    /* القياسات والتأثيرات */
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.08);
}

/* ----------------------------------------------------
   تنسيقات الصفحة العامة (General Styles)
   ---------------------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

/* عناصر الخلفية المتوهجة (Ambient Glow) */
.glass-bg-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(130px);
    opacity: 0.08;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background-color: var(--accent);
    top: -100px;
    left: -100px;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background-color: var(--info-blue);
    bottom: -100px;
    right: -100px;
}

/* ----------------------------------------------------
   هيكل الصفحة والترتيب (Layout)
   ---------------------------------------------------- */
.container {
    width: 100%;
    max-width: 1200px;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* الهيدر (Header) */
.app-header {
    text-align: center;
    margin-bottom: 10px;
}

.logo-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 12px;
}

.smarpix-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #ffffff;
    padding: 6px 18px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
    transition: var(--transition);
}

.smarpix-logo-container:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.smarpix-logo-img {
    height: 42px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.smarpix-logo-text {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    font-family: 'Tajawal', sans-serif;
}

.smarpix-s {
    color: #0f172a;
}

.smarpix-p {
    color: var(--accent);
}

.header-divider {
    width: 2px;
    height: 30px;
    background-color: var(--border-color);
    margin: 0 5px;
}

.app-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.accent-text {
    color: var(--accent);
    text-shadow: 0 0 12px rgba(255, 184, 3, 0.2);
}

.subtitle {
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
    font-size: 1.05rem;
    font-weight: 400;
}

.subtitle strong {
    color: var(--text-primary);
}

/* الشبكة الرئيسية (Grid) */
.advisor-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    align-items: start;
}

/* البطاقات بنظام Glassmorphism */
.card {
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.panel-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 12px;
    display: flex;
    align-items: center;
}

.icon-margin {
    margin-left: 10px;
    color: var(--accent);
}

/* ----------------------------------------------------
   عناصر نموذج الإدخال (Form Fields)
   ---------------------------------------------------- */
.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* تخصيص قائمة الاختيار (Styled Select) */
.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper select {
    width: 100%;
    padding: 14px 16px;
    background-color: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: var(--transition);
}

.select-wrapper select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.select-arrow {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    transition: var(--transition);
}

.select-wrapper select:focus + .select-arrow {
    color: var(--accent);
    transform: translateY(-50%) rotate(180deg);
}

/* بطاقة معلومات الطابعة (Printer Info Bubble) */
.info-bubble {
    background: rgba(255, 184, 3, 0.06);
    border: 1.5px dashed rgba(255, 184, 3, 0.3);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: -12px;
    margin-bottom: 20px;
}

.info-bubble h4 {
    font-size: 0.95rem;
    color: var(--accent-hover);
    margin-bottom: 6px;
    font-weight: 700;
}

.info-bubble p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.printer-features-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* شبكة غايات الطباعة (Purposes Layout) */
.purposes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.purpose-card-option {
    background-color: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 10px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    user-select: none;
}

.purpose-card-option:hover {
    border-color: var(--border-color-hover);
    transform: translateY(-2px);
}

.purpose-card-option.selected {
    border-color: var(--accent);
    background: var(--accent-glow);
    box-shadow: 0 0 15px rgba(255, 184, 3, 0.15);
}

.card-icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.purpose-card-option.selected .card-icon-wrapper {
    background: var(--accent);
    color: #0f172a;
    box-shadow: 0 0 10px rgba(255, 184, 3, 0.4);
}

.purpose-title {
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.purpose-card-option.selected .purpose-title {
    color: var(--text-primary);
}

/* ----------------------------------------------------
   شاشة الانتظار والنتائج (Results Panel)
   ---------------------------------------------------- */
.results-panel {
    min-height: 500px;
    display: flex;
    flex-direction: column;
}

/* شاشة الانتظار */
.placeholder-content {
    margin: auto;
    text-align: center;
    max-width: 450px;
    color: var(--text-secondary);
    padding: 40px 20px;
}

.placeholder-icon {
    font-size: 3.5rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    animation: float 4s infinite ease-in-out;
}

.placeholder-content h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: 700;
}

.placeholder-content p {
    font-size: 0.95rem;
}

/* محتوى النتائج الفعلي */
.results-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.results-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 16px;
}

.results-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.text-success {
    color: var(--success);
}

.match-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* بطاقات الفلمنت المقترحة */
.filaments-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.filament-card {
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.02);
}

.filament-card:hover {
    border-color: var(--border-color-hover);
    box-shadow: 0 4px 25px rgba(15, 23, 42, 0.06);
}

/* رأس بطاقة الفلمنت */
.fil-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.fil-title-area h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.fil-title-area h3 .fil-eng-name {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-right: 6px;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-difficulty {
    background: rgba(2, 132, 199, 0.08);
    color: var(--info-blue);
    border: 1px solid rgba(2, 132, 199, 0.2);
}

.badge-incompatible {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.fil-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* شبكة المعاملات والإعدادات */
.fil-params-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.param-item {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 10px;
    text-align: center;
    transition: var(--transition);
}

.param-item:hover {
    border-color: var(--border-color-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.03);
}

.param-icon-wrapper {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    margin: 0 auto 8px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nozzle-icon {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}

.bed-icon {
    background: rgba(245, 158, 11, 0.08);
    color: #f59e0b;
}

.speed-icon {
    background: rgba(16, 185, 129, 0.08);
    color: #10b981;
}

.enclosure-icon {
    background: rgba(28, 163, 196, 0.08);
    color: #1ca3c4;
}

.param-item:hover .param-icon-wrapper {
    transform: scale(1.1);
}

.param-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
}

.param-value {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* الإيجابيات والسلبيات (Pros & Cons) */
.pros-cons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.pros-list, .cons-list {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 16px;
    border: 1px solid #f1f5f9;
}

.pros-list h5, .cons-list h5 {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pros-list h5 { color: var(--success); }
.cons-list h5 { color: var(--danger); }

.pros-list ul, .cons-list ul {
    list-style: none;
}

.pros-list li, .cons-list li {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    position: relative;
    padding-right: 14px;
}

.pros-list li::before {
    content: "✓";
    position: absolute;
    right: 0;
    color: var(--success);
}

.cons-list li::before {
    content: "✗";
    position: absolute;
    right: 0;
    color: var(--danger);
}

/* النصائح والتنبيهات المخصصة للطابعة */
.custom-notes-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 22px;
}

.note-box {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    line-height: 1.5;
}

.note-box-warning {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.note-box-warning i {
    color: #ef4444;
    margin-left: 8px;
}

.note-box-info {
    background: #fffbeb;
    border: 1px solid #fde047;
    color: #92400e;
}

.note-box-info i {
    color: #d97706;
    margin-left: 8px;
}

/* زر الشراء */
.buy-button-wrapper {
    display: flex;
    justify-content: flex-end;
}

.btn-buy {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--accent);
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-buy:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 184, 3, 0.35);
}

/* الجزء القابل للتوسيع وتأثيرات الحركة */
.fil-expandable-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    margin-bottom: 0;
}

.fil-expandable-content.expanded {
    max-height: 1200px; /* ارتفاع كافٍ لعرض جميع البيانات */
    opacity: 1;
    margin-bottom: 20px;
    padding-top: 20px;
    border-top: 1.5px solid var(--border-color);
}

.card-footer-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 15px;
    border-top: 1.5px solid var(--border-color);
    padding-top: 15px;
}

.btn-toggle-details {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    animation: pulseGlow 2.5s infinite ease-in-out;
}

.btn-toggle-details:hover {
    background: var(--bg-dark);
    color: var(--text-primary);
    border-color: var(--border-color-hover);
}

.btn-toggle-details.active {
    animation: none;
    border-color: var(--border-color-hover);
    box-shadow: none;
    background: #f1f5f9;
}

.btn-toggle-details i {
    transition: transform 0.3s ease;
}

.btn-toggle-details:not(.active) i {
    animation: bounceArrow 1.5s infinite ease-in-out;
}

.btn-toggle-details.active i {
    transform: rotate(180deg);
}

/* الرسوم الحركية لجذب الانتباه (Pulsing Glow & Bouncing Arrow) */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(28, 163, 196, 0.08);
        border-color: var(--border-color);
    }
    50% {
        box-shadow: 0 0 12px rgba(28, 163, 196, 0.3);
        border-color: var(--accent);
        background: rgba(28, 163, 196, 0.02);
    }
}

@keyframes bounceArrow {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(2px);
    }
}

/* ----------------------------------------------------
   تنسيقات الفوتر والتحويلات المساعدة
   ---------------------------------------------------- */
.app-footer-info {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.smarpix-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    transition: var(--transition);
}

.smarpix-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.copyright {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.hidden {
    display: none !important;
}

/* ----------------------------------------------------
   التأثيرات الحركية (Animations)
   ---------------------------------------------------- */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.85; filter: drop-shadow(0 0 15px rgba(249, 115, 22, 0.6)); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.animate-fade-in {
    animation: fadeIn 0.6s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-slide-up {
    opacity: 0;
    animation: slideUp 0.6s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ----------------------------------------------------
   شاشات التوافقية والتجاوب (Responsive Media Queries)
   ---------------------------------------------------- */
@media (max-width: 1024px) {
    .advisor-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .selection-panel {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 20px 10px;
    }
    .logo-area {
        flex-direction: column;
        gap: 10px;
    }
    .header-divider {
        display: none;
    }
    .app-header h1 {
        font-size: 1.7rem;
    }
    .purposes-grid {
        grid-template-columns: 1fr;
    }
    .fil-params-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .pros-cons-grid {
        grid-template-columns: 1fr;
    }
    .fil-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .badge {
        align-self: flex-start;
    }
    .card-footer-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .btn-toggle-details {
        width: 100%;
        justify-content: center;
    }
    .btn-buy {
        width: 100%;
        justify-content: center;
    }
}
