/* =========================================================
   traffic.css - نظام المرور (إضافة فقط، لا تعديل على النظام الأساسي)
   ========================================================= */

/* بطاقة الرخصة الفخمة */
.license-card {
    background: linear-gradient(145deg, #1a1f2e, #0f121c);
    border-radius: 28px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid rgba(201,168,76,0.3);
    box-shadow: 0 20px 35px -10px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
    position: relative;
    overflow: hidden;
}

.license-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(201,168,76,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.license-inner {
    background-image: url('https://www.raed.net/img?id=1545827');
    background-size: cover;
    background-position: center;
    border-radius: 20px;
    padding: 28px 24px;
    position: relative;
    backdrop-filter: brightness(0.85);
    box-shadow: inset 0 0 40px rgba(0,0,0,0.5), 0 5px 15px rgba(0,0,0,0.3);
}

.license-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid rgba(201,168,76,0.5);
    padding-bottom: 12px;
}

.license-emblem {
    font-size: 28px;
    filter: drop-shadow(0 0 3px gold);
}

.license-title {
    font-size: 18px;
    font-weight: 900;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    background: rgba(0,0,0,0.5);
    padding: 4px 12px;
    border-radius: 30px;
}

.license-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 25px;
}

.license-field {
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(3px);
    padding: 8px 12px;
    border-radius: 16px;
    border-right: 3px solid var(--gold);
}

.license-field.full {
    grid-column: span 2;
}

.license-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--gold-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 4px;
}

.license-value {
    font-size: 15px;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px black;
    word-break: break-word;
}

.license-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    border-top: 1px dashed rgba(201,168,76,0.4);
    padding-top: 15px;
}

.license-status {
    font-size: 13px;
    font-weight: 800;
    background: rgba(0,0,0,0.7);
    padding: 5px 14px;
    border-radius: 30px;
    color: #2ecc71;
}

.license-status.suspended {
    color: #e74c3c;
}

.license-points {
    background: rgba(0,0,0,0.7);
    padding: 5px 14px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 14px;
}

/* اختبار القيادة */
.exam-question {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

.exam-question-text {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--gold);
}

.exam-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.exam-option {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--dark-3);
    padding: 12px 18px;
    border-radius: 14px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.exam-option:hover {
    border-color: var(--gold);
    background: rgba(201,168,76,0.05);
}

.exam-option.selected {
    border-color: var(--gold);
    background: rgba(201,168,76,0.15);
    box-shadow: 0 0 0 2px rgba(201,168,76,0.2);
}

.exam-option input {
    width: 20px;
    height: 20px;
    accent-color: var(--gold);
    margin: 0;
}

.exam-option label {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    flex: 1;
}

.exam-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
}

.exam-nav button {
    background: var(--dark-4);
    border: 1px solid var(--border);
    padding: 10px 26px;
    border-radius: 40px;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
}

.exam-nav button:hover:not(:disabled) {
    border-color: var(--gold);
    color: var(--gold);
}

.exam-nav button:disabled {
    opacity: 0.4;
    cursor: default;
}

.exam-submit {
    background: var(--gold);
    color: #000;
    border: none;
    padding: 12px 32px;
    font-weight: 800;
}

/* شريط التقدم */
.exam-progress {
    background: var(--dark-3);
    border-radius: 40px;
    height: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.exam-progress-fill {
    height: 100%;
    background: var(--gold);
    width: 0%;
    transition: width 0.3s;
    border-radius: 40px;
}

/* لوحة تحكم المرور - جداول */
.traffic-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

.traffic-table th {
    background: var(--gold-dim);
    color: var(--gold);
    padding: 14px;
    font-weight: 700;
    text-align: right;
}

.traffic-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* حالة الرسائل */
.traffic-message {
    background: rgba(201,168,76,0.1);
    border-right: 3px solid var(--gold);
    padding: 14px 20px;
    border-radius: 12px;
    margin-top: 16px;
    font-size: 14px;
}

/* مودال النجاح/الرسوب بسيط */
.traffic-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #0a0e16;
    border: 1px solid var(--gold);
    border-radius: 50px;
    padding: 14px 30px;
    z-index: 2000;
    font-weight: 700;
    color: var(--gold);
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    animation: fadeUp 0.3s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* =========================================================
   إضافات CSS مطلوبة من traffic.js
   ========================================================= */

/* ===== شريط الخطوات (laws / exam / sim / result) ===== */
.laws-header-banner {
    margin-bottom: 24px;
}

.laws-step-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
}

.laws-step {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted, #888);
    padding: 5px 10px;
    border-radius: 20px;
    white-space: nowrap;
    background: rgba(255,255,255,0.04);
    border: 1px solid transparent;
    transition: all 0.3s;
}

.laws-step.active {
    color: var(--gold, #c9a84c);
    background: rgba(201,168,76,0.12);
    border-color: rgba(201,168,76,0.3);
}

.laws-step.done {
    color: #2ecc71;
    background: rgba(46,204,113,0.1);
    border-color: rgba(46,204,113,0.2);
}

.laws-step-line {
    flex: 1;
    height: 2px;
    min-width: 16px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    transition: background 0.3s;
}

.laws-step-line.active {
    background: var(--gold, #c9a84c);
}

/* ===== بطاقة القانون ===== */
.law-card-page {
    background: var(--card, #1a1f2e);
    border: 1px solid rgba(201,168,76,0.15);
    border-radius: 20px;
    padding: 32px 28px;
    animation: fadeIn 0.3s ease;
}

.law-card-icon {
    font-size: 52px;
    text-align: center;
    margin-bottom: 14px;
    filter: drop-shadow(0 0 8px rgba(201,168,76,0.4));
}

.law-card-title {
    color: var(--gold, #c9a84c);
    font-size: 20px;
    font-weight: 900;
    text-align: center;
    margin-bottom: 24px;
    letter-spacing: 0.5px;
}

.law-rules-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.law-rules-list li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text, #e0e0e0);
    background: rgba(255,255,255,0.03);
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.law-bullet {
    color: var(--gold, #c9a84c);
    flex-shrink: 0;
    margin-top: 2px;
    font-size: 13px;
}

.law-progress-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 28px;
}

.law-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    transition: all 0.3s;
}

.law-dot.active {
    background: var(--gold, #c9a84c);
    border-color: var(--gold, #c9a84c);
    box-shadow: 0 0 8px rgba(201,168,76,0.5);
    transform: scale(1.2);
}

.law-dot.done {
    background: #2ecc71;
    border-color: #2ecc71;
}

/* ===== محاكاة القيادة (Simulation) ===== */
.sim-container {
    background: var(--card, #1a1f2e);
    border: 1px solid rgba(201,168,76,0.15);
    border-radius: 20px;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.sim-task-badge {
    display: inline-block;
    background: rgba(201,168,76,0.12);
    border: 1px solid rgba(201,168,76,0.3);
    color: var(--gold, #c9a84c);
    font-size: 13px;
    font-weight: 800;
    padding: 5px 14px;
    border-radius: 30px;
    margin-bottom: 16px;
}

.sim-scene {
    border-radius: 14px;
    margin-bottom: 20px;
    min-height: 160px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #1a2a1a 0%, #2a3a2a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sim-question-box {
    padding: 4px 0;
}

.sim-title {
    color: var(--gold, #c9a84c);
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 8px;
}

.sim-desc {
    color: var(--text-muted, #999);
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 20px;
    background: rgba(255,255,255,0.03);
    padding: 12px 16px;
    border-radius: 10px;
    border-right: 3px solid rgba(201,168,76,0.4);
}

.sim-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sim-choice-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 13px 18px;
    border-radius: 12px;
    color: var(--text, #e0e0e0);
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: right;
    transition: all 0.2s;
    width: 100%;
}

.sim-choice-btn:hover {
    border-color: var(--gold, #c9a84c);
    background: rgba(201,168,76,0.08);
    color: var(--gold, #c9a84c);
    transform: translateX(-3px);
}

.sim-feedback {
    padding: 14px 18px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    margin-top: 12px;
    line-height: 1.6;
    animation: fadeIn 0.3s ease;
}

.sim-feedback.correct {
    background: rgba(46,204,113,0.12);
    border: 1px solid rgba(46,204,113,0.35);
    color: #2ecc71;
}

.sim-feedback.wrong {
    background: rgba(231,76,60,0.12);
    border: 1px solid rgba(231,76,60,0.35);
    color: #e74c3c;
}

/* ===== مشاهد الطريق ===== */
.road-scene {
    position: relative;
    width: 100%;
    min-height: 150px;
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.road-lines {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: repeating-linear-gradient(
        to right,
        transparent 0,
        transparent calc(50% - 4px),
        rgba(240,192,64,0.5) calc(50% - 4px),
        rgba(240,192,64,0.5) calc(50% + 4px),
        transparent calc(50% + 4px)
    );
    mask-image: repeating-linear-gradient(
        to bottom,
        black 0,
        black 20px,
        transparent 20px,
        transparent 40px
    );
}

.road-highway {
    background: linear-gradient(180deg, #1e1e2e 0%, #2a2a3a 100%);
}

.road-yellow-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        #f1c40f 0,
        #f1c40f 20px,
        transparent 20px,
        transparent 40px
    );
}

.traffic-light-sim {
    position: absolute;
    top: 12px;
    left: 16px;
}

.tl-housing {
    background: #2a2a2a;
    border: 2px solid #444;
    border-radius: 10px;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

.tl-light {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #333;
}

.red-off   { background: rgba(231,76,60,0.25); }
.yellow-on { background: #f1c40f; box-shadow: 0 0 14px #f1c40f, 0 0 28px rgba(241,196,15,0.5); }
.green-off { background: rgba(46,204,113,0.25); }

.car-sim { font-size: 34px; line-height: 1; }

.truck-car { font-size: 38px; }

.player-car { position: relative; }

.player-behind {
    margin-top: 16px;
}

.accident-scene {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 28px;
}

.accident-sparks { font-size: 22px; animation: pulse 0.5s ease infinite alternate; }

@keyframes pulse {
    from { transform: scale(0.9); }
    to   { transform: scale(1.1); }
}

/* ===== بطاقة نتيجة النقاط ===== */
.points-result-card {
    border-radius: 16px;
    padding: 20px;
    margin-top: 16px;
    animation: fadeIn 0.3s ease;
}

.points-added {
    background: rgba(46,204,113,0.06);
    border: 1px solid rgba(46,204,113,0.25);
}

.points-removed {
    background: rgba(231,76,60,0.06);
    border: 1px solid rgba(231,76,60,0.25);
}

.points-result-header {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.points-result-icon {
    font-size: 30px;
    flex-shrink: 0;
}

.points-result-action {
    font-weight: 800;
    font-size: 15px;
    color: var(--text, #e0e0e0);
    margin-bottom: 4px;
}

.points-result-name {
    color: var(--text-muted, #999);
    font-size: 13px;
}

.points-result-change {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px 16px;
    background: rgba(0,0,0,0.25);
    border-radius: 12px;
}

.points-old {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-muted, #999);
}

.points-arrow {
    color: var(--gold, #c9a84c);
    font-size: 13px;
    font-weight: 700;
    flex: 1;
    text-align: center;
}

.points-new {
    font-size: 26px;
    font-weight: 900;
}

.points-max {
    color: var(--text-muted, #999);
    font-size: 13px;
}

.points-bar-wrap {
    height: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 30px;
    overflow: hidden;
    margin-bottom: 14px;
}

.points-bar-fill {
    height: 100%;
    border-radius: 30px;
    transition: width 0.6s ease;
}

.points-reason {
    color: var(--text-muted, #999);
    font-size: 13px;
    background: rgba(255,255,255,0.04);
    padding: 10px 14px;
    border-radius: 10px;
    border-right: 2px solid rgba(201,168,76,0.4);
    margin-top: 10px;
}

.points-suspended-alert {
    background: rgba(231,76,60,0.12);
    border: 1px solid rgba(231,76,60,0.3);
    color: #e74c3c;
    text-align: center;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 14px;
    margin-top: 12px;
}

.points-warning-alert {
    background: rgba(243,156,18,0.12);
    border: 1px solid rgba(243,156,18,0.3);
    color: #f39c12;
    text-align: center;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 14px;
    margin-top: 12px;
}

.points-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    color: var(--text-muted, #999);
    font-size: 14px;
}

.points-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.1);
    border-top-color: var(--gold, #c9a84c);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes popIn {
    0%   { transform: scale(0.5); opacity: 0; }
    70%  { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}

/* ===== تحسينات إضافية ===== */
.car-accident-1,
.car-accident-2 {
    font-size: 28px;
    display: inline-block;
}

.car-accident-1 {
    transform: rotate(-15deg);
}

.car-accident-2 {
    transform: rotate(10deg);
}


/* ===== قائمة المخالفات ===== */
#trafficViolationType {
    width: 100%;
    background: var(--dark-3, #1a1f2e);
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text, #e0e0e0);
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23c9a84c' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 16px center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#trafficViolationType:hover,
#trafficViolationType:focus {
    border-color: var(--gold, #c9a84c);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
    outline: none;
}

#trafficViolationType option {
    background: #1a1f2e;
    color: #e0e0e0;
    font-weight: 600;
    padding: 8px;
}
