/* --- الألوان والخطوط (WarEra Theme) --- */
:root {
    --bg-dark: #0b0e14;       /* خلفية كحلية عميقة */
    --panel-bg: rgba(21, 27, 38, 0.95); /* خلفية القوائم */
    --border-color: #2a3b4e;  /* حدود زرقاء باهتة */
    --accent-cyan: #38bdf8;   /* اللون الرئيسي (الأزرار والعناوين) */
    --accent-gold: #fbbf24;   /* لون الذهب */
    --accent-green: #34d399;  /* لون الربح */
    --accent-red: #f87171;    /* لون الخسارة */
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Rajdhani', 'Cairo', sans-serif;
    margin: 0;
    padding: 20px;
    padding-bottom: 60px;
    /* تدرج لوني يشبه خلفية اللعبة */
    background-image: radial-gradient(circle at 50% 0%, #1e293b 0%, #0b0e14 100%);
    min-height: 100vh;
}

/* الشبكة الخلفية (Tactical Grid) */
.bg-grid {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    pointer-events: none;
}

/* Header */
header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 30px; border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
}
.logo { font-size: 1.8rem; font-weight: 700; letter-spacing: 1px; }
.logo-icon { color: var(--accent-gold); margin-right: 5px; }
.highlight { color: var(--accent-cyan); }

/* --- الكروت والقوائم (Game Panels) --- */
.game-panel {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    margin-bottom: 20px;
    overflow: hidden;
}

.hero-panel { text-align: center; padding: 20px; border-top: 3px solid var(--accent-cyan); }
.panel-header { margin-bottom: 10px; }
.panel-header h2 { margin: 0; color: var(--text-muted); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 2px; }

.pp-display {
    font-family: 'Rajdhani', sans-serif;
    font-size: 3.5rem; font-weight: 700;
    color: var(--accent-green);
    text-shadow: 0 0 15px rgba(52, 211, 153, 0.3);
}
.pp-sub { color: var(--text-muted); font-size: 0.9rem; margin-top: -5px; }

/* --- الجدول --- */
table { width: 100%; border-collapse: collapse; }
th {
    text-align: inherit; padding: 15px;
    background: rgba(56, 189, 248, 0.05);
    color: var(--accent-cyan);
    font-size: 0.8rem; letter-spacing: 1px;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
}
td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
tbody tr:hover { background-color: rgba(255,255,255,0.03); }

.item-cell { display: flex; align-items: center; gap: 15px; }
.item-icon {
    width: 40px; height: 40px;
    background: #050505; border: 1px solid #333; border-radius: 4px;
}
.item-name { font-weight: 700; color: #fff; font-size: 1rem; }

/* الأسعار */
.price-cell, .fair-cell, .final-price {
    font-family: 'Rajdhani', monospace; font-weight: 700; font-size: 1.2rem;
}
.price-yellow { color: var(--accent-gold); }
.price-green { color: var(--accent-green); }
.price-red { color: var(--accent-red); }
.fair-cell { color: var(--text-muted); }

/* الأزرار */
.game-btn, .action-btn {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
    padding: 6px 20px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    cursor: pointer; border-radius: 2px;
    transition: 0.2s;
}
.game-btn:hover, .action-btn:hover {
    background: var(--accent-cyan); color: #000; box-shadow: 0 0 15px var(--accent-cyan);
}

/* --- Modal --- */
.modal {
    display: none; position: fixed; z-index: 10000;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.85); backdrop-filter: blur(5px);
}
.modal-content {
    margin: 10% auto; width: 95%; max-width: 500px;
    border: 1px solid var(--accent-cyan);
    background: #11151c;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 20px; border-bottom: 1px solid var(--border-color);
    background: rgba(56, 189, 248, 0.05);
}
.modal-header h3 { margin: 0; color: var(--accent-cyan); }
.close-btn { color: #fff; font-size: 24px; cursor: pointer; }
.modal-body-content { padding: 20px; }

/* Inputs */
.variables-section {
    display: flex; gap: 10px; margin-bottom: 20px;
    background: rgba(0,0,0,0.2); padding: 15px; border: 1px solid var(--border-color);
}
.input-group { flex: 1; }
.input-group label { display: block; color: var(--text-muted); font-size: 0.8rem; margin-bottom: 5px; }
.input-group input {
    width: 100%; background: #080a0f; border: 1px solid var(--border-color);
    color: var(--accent-cyan); padding: 10px; text-align: center;
    font-family: 'Rajdhani', sans-serif; font-weight: bold; font-size: 1.2rem;
    box-sizing: border-box;
}
.input-group input:focus { border-color: var(--accent-cyan); outline: none; }

/* Comparison */
.comparison-box { display: flex; gap: 10px; margin-bottom: 20px; }
.method-card {
    flex: 1; background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color); padding: 15px; border-radius: 4px;
}
.method-card.winner { border-color: var(--accent-green); background: rgba(52, 211, 153, 0.05); }
.method-title { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 10px; font-weight: bold; }
.result-row { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-color); }

.recommendation {
    text-align: center; padding: 12px; margin-bottom: 15px; font-weight: bold; border-radius: 4px;
}
.rec-buy { background: rgba(248, 113, 113, 0.15); color: var(--accent-red); border: 1px solid var(--accent-red); }
.rec-craft { background: rgba(52, 211, 153, 0.15); color: var(--accent-green); border: 1px solid var(--accent-green); }

/* --- PYXIS Signature --- */
.pyxis-wrapper {
    display: flex; justify-content: center; align-items: center;
    margin-top: 50px; padding-bottom: 20px;
    direction: ltr !important; position: relative;
}
.pyxis-link-overlay {
    position: absolute; top: -10px; left: -10px; right: -10px; bottom: -10px; z-index: 10; cursor: pointer;
}
.pyxis-animation {
    font-family: 'Courier New', monospace; font-size: 14px; font-weight: 700;
    letter-spacing: 8px; display: flex;
}
.pyxis-animation span {
    color: #4b5563; opacity: 0.5; animation: pyxis-wave 3s infinite ease-in-out;
}
@keyframes pyxis-wave {
    0%, 100% { opacity: 0.5; transform: translateY(0); }
    50% { opacity: 1; color: var(--accent-cyan); text-shadow: 0 0 8px var(--accent-cyan); }
}
.pyxis-animation span:nth-child(1) { animation-delay: 0.0s; }
.pyxis-animation span:nth-child(2) { animation-delay: 0.2s; }
.pyxis-animation span:nth-child(3) { animation-delay: 0.4s; }
.pyxis-animation span:nth-child(4) { animation-delay: 0.6s; }
.pyxis-animation span:nth-child(5) { animation-delay: 0.8s; }

/* --- تنسيق أيقونة المعلومات والشرح (Fixed Overlay Mode) --- */
.tooltip-container {
    position: relative;
    cursor: help;
    display: flex;
    align-items: center;
    justify-content: center; /* توسيط */
    gap: 5px;
    outline: none;
}

.info-icon {
    display: inline-flex; justify-content: center; align-items: center;
    width: 16px; height: 16px;
    background-color: rgba(56, 189, 248, 0.1);
    border: 1px solid var(--accent-cyan); color: var(--accent-cyan);
    border-radius: 50%; font-size: 11px; font-weight: bold;
}

/* النص المخفي */
.tooltip-text {
    visibility: hidden; opacity: 0;
    position: fixed; /* ثابت في منتصف الشاشة */
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 280px; /* عرض ثابت ومناسب للهاتف */
    background-color: #151922; color: #fff; text-align: center;
    border: 1px solid var(--accent-cyan); border-radius: 8px;
    padding: 15px;
    z-index: 99999;
    box-shadow: 0 0 50px rgba(0,0,0,0.9);
    font-size: 0.9rem; line-height: 1.5;
    pointer-events: none; transition: opacity 0.2s;
}

/* إظهار النص عند اللمس أو المرور */
.tooltip-container:hover .tooltip-text,
.tooltip-container:focus .tooltip-text {
    visibility: visible; opacity: 1;
}

/* --- تحسينات الموبايل (Mobile Fixes) --- */
@media (max-width: 768px) {
    body {
        padding: 10px;
        padding-bottom: 80px; /* مساحة للتوقيع */
    }

    /* إصلاح الجدول للهاتف */
    th, td {
        padding: 8px 5px; /* تقليل الحواف */
        font-size: 0.8rem; /* تصغير الخط */
    }
    
    .item-cell { gap: 8px; }
    .item-icon { width: 28px; height: 28px; } /* تصغير الأيقونات */
    .item-name { font-size: 0.85rem; }
    
    .price-cell, .fair-cell { font-size: 0.9rem; }
    
    /* تصغير زر التحليل */
    .action-btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    /* إصلاح النافذة المنبثقة الكبيرة (Modal) */
    .modal-content {
        width: 90%;
        margin: 20% auto;
        padding: 15px;
    }
    
    .comparison-box { flex-direction: column; } /* الكروت فوق بعض */
    
    .pyxis-wrapper { margin-top: 30px; }
}
