/* =============================================
   style.css — مساعد تحديد المسار
   بوابة أبو عنكبوت التعليمية
   ============================================= */

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

:root {
    --green:        #22c55e;
    --green-dark:   #16a34a;
    --green-light:  #dcfce7;
    --green-bg:     #f0fdf4;
    --gray-50:      #f9fafb;
    --gray-100:     #f3f4f6;
    --gray-200:     #e5e7eb;
    --gray-400:     #9ca3af;
    --gray-600:     #4b5563;
    --gray-700:     #374151;
    --gray-800:     #1f2937;
    --gray-900:     #111827;
    --dark-bubble:  #1f2937;
    --dark-text:    #f9fafb;
    --bot-bubble:   #f0fdf4;
    --bot-text:     #166534;
    --bot-border:   #bbf7d0;
    --shadow:       0 4px 24px rgba(0,0,0,0.07);
}

body {
    font-family: 'Cairo', sans-serif;
    background: #f4f6f9;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(34,197,94,0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(34,197,94,0.04) 0%, transparent 50%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===== NAVBAR ===== */
nav {
    width: 100%;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 8px rgba(0,0,0,0.04);
}

.nav-brand { display: flex; align-items: center; gap: 10px; }

.nav-avatar {
    width: 40px; height: 40px;
    background: var(--green);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}

.nav-brand-text strong { display: block; font-size: 14px; font-weight: 700; color: var(--gray-900); }
.nav-brand-text span   { font-size: 11px; color: var(--green-dark); font-weight: 500; }

.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; }

.nav-links a {
    text-decoration: none; color: var(--gray-600);
    font-size: 13px; font-weight: 500;
    padding: 6px 12px; border-radius: 8px;
    transition: background .15s;
}
.nav-links a:hover  { background: var(--gray-100); }
.nav-links a.active { background: var(--green); color: white; }

.nav-actions { display: flex; gap: 8px; }

/* ===== MAIN ===== */
main { width: 100%; max-width: 780px; padding: 32px 16px 48px; }

/* ===== CHAT CARD ===== */
.chat-card {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

/* ===== HEADER ===== */
.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex; align-items: center; gap: 12px;
    position: relative;
}

.chat-header-avatar {
    width: 44px; height: 44px;
    background: var(--green); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}

.chat-header-info { flex: 1; }
.chat-header-info h2 { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.chat-header-info p  { font-size: 12px; color: var(--gray-400); margin-top: 1px; }

.chat-header-badge {
    background: var(--green-light); color: var(--green-dark);
    font-size: 11px; font-weight: 600;
    padding: 4px 10px; border-radius: 20px;
    display: flex; align-items: center; gap: 4px;
}

.chat-header-meta {
    display: flex; gap: 16px; align-items: center;
    font-size: 12px; color: var(--gray-400);
    margin-top: 6px; justify-content: flex-end;
}

.chat-header-tag {
    position: absolute; top: 10px; left: 16px;
    background: var(--gray-100); color: var(--gray-600);
    font-size: 11px; padding: 3px 10px; border-radius: 12px;
}

/* ===== MESSAGES ===== */
.chat-messages {
    padding: 20px;
    display: flex; flex-direction: column; gap: 12px;
    min-height: 320px; max-height: 520px;
    overflow-y: auto; scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 4px; }

.msg-bot {
    display: flex; align-items: flex-start; gap: 10px;
    max-width: 92%; animation: fadeUp .3s ease;
}

.msg-bot-avatar {
    width: 34px; height: 34px;
    background: var(--green); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; flex-shrink: 0; margin-top: 2px;
}

.msg-bot-bubble {
    background: var(--bot-bubble); color: var(--bot-text);
    padding: 12px 16px;
    border-radius: 4px 18px 18px 18px;
    font-size: 14px; line-height: 1.8;
    white-space: pre-line;
    border: 1px solid var(--bot-border);
}

.msg-user { display: flex; justify-content: flex-end; animation: fadeUp .3s ease; }

.msg-user-bubble {
    background: var(--dark-bubble); color: var(--dark-text);
    padding: 10px 18px;
    border-radius: 18px 4px 18px 18px;
    font-size: 14px; font-weight: 500; max-width: 80%;
}

/* typing */
.typing-indicator { display: flex; align-items: flex-start; gap: 10px; }

.typing-dots {
    background: var(--bot-bubble); border: 1px solid var(--bot-border);
    padding: 12px 18px; border-radius: 4px 18px 18px 18px;
    display: flex; gap: 5px; align-items: center;
}

.typing-dots span {
    width: 7px; height: 7px;
    background: var(--green); border-radius: 50%;
    animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes bounce {
    0%,60%,100% { transform: translateY(0); }
    30%          { transform: translateY(-6px); }
}

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

/* ===== COOLDOWN BANNER ===== */
.cooldown-banner {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #fff7ed;
    border-top: 1px solid #fed7aa;
    border-bottom: 1px solid #fed7aa;
    padding: 10px 20px;
    animation: fadeUp .3s ease;
}

.cooldown-icon {
    font-size: 20px;
    animation: spin 1s linear infinite;
}

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

.cooldown-text {
    font-size: 14px;
    color: #92400e;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cooldown-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f97316;
    color: white;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    flex-shrink: 0;
    box-shadow: 0 0 0 4px #fed7aa;
    animation: pulse-orange 1s ease infinite;
}

@keyframes pulse-orange {
    0%,100% { box-shadow: 0 0 0 4px #fed7aa; }
    50%      { box-shadow: 0 0 0 8px #ffedd5; }
}

/* ===== COUNTER & PROGRESS ===== */
.question-counter {
    text-align: center; font-size: 12px;
    color: var(--gray-400); font-weight: 500;
    padding: 0 20px 4px;
}

.progress-wrap { padding: 0 20px 10px; }

.progress-bar-bg {
    background: var(--gray-100); border-radius: 99px;
    height: 4px; overflow: hidden;
}

.progress-bar-fill {
    background: var(--green); height: 100%;
    border-radius: 99px; transition: width .4s ease;
}

/* ===== OPTIONS ===== */
.options-container {
    padding: 4px 20px 16px;
    display: flex; flex-direction: column; gap: 8px;
    animation: fadeUp .4s ease;
}

.option-btn {
    width: 100%; background: white;
    border: 1px solid var(--gray-200); border-radius: 12px;
    padding: 13px 18px; font-size: 14px; font-weight: 500;
    color: var(--gray-800); cursor: pointer;
    text-align: right; font-family: 'Cairo', sans-serif;
    transition: all .18s; line-height: 1.5;
}
.option-btn:hover:not(:disabled) {
    border-color: var(--green); background: var(--green-bg);
    color: var(--green-dark); transform: translateX(-3px);
}
.option-btn:disabled { cursor: not-allowed; opacity: 0.5; }

/* ===== INPUT ===== */
.chat-input-area {
    padding: 12px 16px; border-top: 1px solid var(--gray-100);
    display: flex; align-items: center; gap: 10px;
}

.input-label {
    font-size: 12px; color: var(--gray-400);
    white-space: nowrap; min-width: fit-content;
}

.chat-input {
    flex: 1; border: 1px solid var(--gray-200); border-radius: 10px;
    padding: 10px 16px; font-size: 14px;
    font-family: 'Cairo', sans-serif; color: var(--gray-800);
    background: var(--gray-50); outline: none;
    transition: border-color .15s; text-align: right;
}
.chat-input::placeholder { color: var(--gray-400); }
.chat-input:focus  { border-color: var(--green); background: white; }
.chat-input.error  { border-color: #ef4444; }
.chat-input:disabled { cursor: not-allowed; }

.send-btn {
    width: 40px; height: 40px; background: var(--green);
    border: none; border-radius: 10px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s; flex-shrink: 0;
}
.send-btn:hover:not(:disabled) { background: var(--green-dark); }
.send-btn:disabled { cursor: not-allowed; opacity: 0.5; }
.send-btn svg { width: 18px; height: 18px; fill: white; }

/* ===== GENDER BUTTONS ===== */
.gender-btns {
    padding: 4px 20px 16px;
    display: flex; gap: 12px;
    animation: fadeUp .4s ease;
}

.gender-btn {
    flex: 1; background: white;
    border: 1px solid var(--gray-200); border-radius: 12px;
    padding: 14px; font-size: 15px; font-weight: 600;
    cursor: pointer; font-family: 'Cairo', sans-serif;
    transition: all .18s; color: var(--gray-800);
}
.gender-btn:hover:not(:disabled) {
    border-color: var(--green); background: var(--green-bg);
    color: var(--green-dark);
}

/* ===== SELECT ===== */
.gov-select {
    width: 100%; border: 1px solid var(--gray-200); border-radius: 10px;
    padding: 10px 16px; font-size: 14px;
    font-family: 'Cairo', sans-serif; color: var(--gray-800);
    background: var(--gray-50); outline: none; cursor: pointer;
    transition: border-color .15s;
}
.gov-select:focus { border-color: var(--green); background: white; }

/* ===== START BUTTON ===== */
.start-btn {
    width: calc(100% - 40px); margin: 0 20px 20px;
    background: var(--green); color: white; border: none;
    border-radius: 14px; padding: 16px; font-size: 16px; font-weight: 700;
    cursor: pointer; font-family: 'Cairo', sans-serif;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: background .15s; animation: fadeUp .4s ease;
}
.start-btn:hover { background: var(--green-dark); }

/* ===== RESULT ===== */
.result-card {
    margin: 0 20px; background: #eff6ff;
    border-radius: 16px; padding: 20px; text-align: center;
    border: 1px solid #bfdbfe; animation: fadeUp .5s ease;
}
.result-card .result-icon  { font-size: 36px; margin-bottom: 8px; }
.result-card .result-label { font-size: 12px; color: #6b7280; font-weight: 500; }
.result-card .result-title { font-size: 22px; font-weight: 800; color: #1e3a5f; margin-top: 4px; }

.contact-card {
    margin: 12px 20px 0; background: white;
    border: 1px solid var(--gray-200); border-radius: 16px;
    padding: 18px 20px; animation: fadeUp .6s ease;
}

.contact-card h3 {
    font-size: 15px; font-weight: 700; color: var(--gray-800);
    margin-bottom: 12px; display: flex; align-items: center; gap: 6px;
}

.contact-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }

.contact-list li {
    font-size: 13px; color: var(--gray-700);
    display: flex; align-items: center; justify-content: flex-end; gap: 6px;
}
.contact-list a { color: #2563eb; text-decoration: none; font-weight: 500; }
.contact-list a:hover { text-decoration: underline; }

.disclaimer { font-size: 11px; color: #ef4444; text-align: center; padding: 10px 20px 0; }

.result-actions {
    display: flex; gap: 10px; padding: 12px 20px 20px;
    animation: fadeUp .7s ease;
}

.btn-reset {
    flex: 1; background: var(--green); color: white; border: none;
    padding: 13px; border-radius: 12px;
    font-size: 14px; font-weight: 700; cursor: pointer;
    font-family: 'Cairo', sans-serif;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: background .15s;
}
.btn-reset:hover { background: var(--green-dark); }

.btn-reset-name {
    flex: 1; background: white; color: var(--gray-700);
    border: 1px solid var(--gray-200); padding: 13px; border-radius: 12px;
    font-size: 14px; font-weight: 600; cursor: pointer;
    font-family: 'Cairo', sans-serif; transition: background .15s;
}
.btn-reset-name:hover { background: var(--gray-100); }

.back-link {
    text-align: center; font-size: 13px; color: var(--gray-400);
    padding: 0 20px 16px; cursor: pointer; transition: color .15s;
}
.back-link:hover { color: var(--gray-700); }

/* ===== FOOTER ===== */
.footer-info {
    text-align: center; font-size: 12px; color: var(--gray-400);
    margin-top: 16px; line-height: 1.8; padding: 0 8px;
}

/* ===== SPONSORS ===== */
.sponsors-container { margin-top: 32px; }

.sponsors-title {
    position: relative; text-align: center;
    margin: 40px 0 20px; font-weight: bold; color: #006837;
}
.sponsors-title::after {
    content: ""; display: block;
    width: 60px; height: 3px;
    background: #f9bc15; margin: 10px auto;
}

.sponsor-card {
    background: white; border-radius: 15px; padding: 20px;
    height: 100%; border: 1px solid #eee;
    transition: 0.3s; text-align: center;
}
.sponsor-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }

.sponsor-logo {
    width: 85px; height: 85px; object-fit: cover;
    border-radius: 50%; margin-bottom: 15px;
    border: 3px solid #f9bc15; padding: 3px; background: #fff;
}

.sponsor-app-name {
    font-weight: bold; color: #333; margin-bottom: 15px;
    border-bottom: 1px solid #f4f4f4; padding-bottom: 10px;
}

.app-link {
    text-decoration: none; color: #555;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 8px; font-size: 0.9rem; transition: 0.2s;
}
.app-link i { margin-left: 10px; font-size: 1.1rem; }
.app-link:hover { color: #006837; font-weight: bold; }
.link-android { color: #3DDC84; }
.link-apple   { color: #000; }
.link-huawei  { color: #cf0a2c; }
.link-fb      { color: #1877F2; }
.link-web     { color: #006837; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .nav-links { display: none; }
    nav { padding: 0 12px; }
    main { padding: 16px 8px 32px; }
    .chat-messages { max-height: 400px; }
    .gender-btns { flex-direction: column; }
    .cooldown-text { font-size: 12px; }
}
