/* ========= القواعد العامة ========= */

* {
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background: #020617;
    color: #e5e7eb;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.container {
    margin-top: 40px;
    background: #020617;
    padding: 24px 28px;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

/* ========= رأس الصفحة ========= */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
}

.badge {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #22c55e55;
    font-size: 11px;
    color: #bbf7d0;
}

.subtitle {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #9ca3af;
}

/* ========= الفورم ========= */

.form-section {
    background: #020617;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #1f2937;
    margin-bottom: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

label {
    font-size: 13px;
    color: #e5e7eb;
}

input[type="file"],
select {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #374151;
    background: #020617;
    color: #e5e7eb;
    font-size: 14px;
}

input[type="file"]::-webkit-file-upload-button {
    padding: 6px 12px;
    margin-right: 8px;
    border-radius: 6px;
    border: none;
    background: #2563eb;
    color: white;
    cursor: pointer;
    font-size: 13px;
}

input[type="file"]::-webkit-file-upload-button:hover {
    background: #1d4ed8;
}

.btn-primary {
    margin-top: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    font-size: 15px;
    cursor: pointer;
    font-weight: 600;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

/* ========= صناديق المعلومات والنتائج ========= */

.info-box {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #020617;
    border: 1px dashed #4b5563;
    font-size: 13px;
    color: #9ca3af;
}

.result-box {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #020617;
    border: 1px solid #22c55e55;
    font-size: 14px;
}

.result-error {
    border-color: #f97373aa;
    color: #fecaca;
}

.download-link {
    color: #60a5fa;
    text-decoration: underline;
}

/* ========= الفوتر ========= */

.footer {
    margin-top: 18px;
    font-size: 12px;
    color: #6b7280;
    text-align: center;
}

/* ========= AI Chat Widget ========= */

.ai-chat-launcher {
    position: fixed;
    bottom: 24px;
    left: 24px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #f9fafb;
    padding: 10px 16px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.8);
    z-index: 1000;
}

.ai-chat-launcher:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.ai-chat-window {
    position: fixed;
    bottom: 80px;
    left: 24px;
    width: 320px;
    max-height: 420px;
    background: #020617;
    border-radius: 16px;
    border: 1px solid #1f2937;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.9);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
}

.ai-chat-window.open {
    display: flex;
}

.ai-chat-header {
    padding: 10px 12px;
    background: #020617;
    border-bottom: 1px solid #1f2937;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #e5e7eb;
}

.ai-chat-close {
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
}

.ai-chat-messages {
    flex: 1;
    padding: 8px 10px;
    overflow-y: auto;
    background: #020617;
}

.ai-chat-message {
    margin-bottom: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.ai-chat-message.from-user {
    background: #1d4ed8;
    color: #f9fafb;
    align-self: flex-end;
}

.ai-chat-message.from-bot {
    background: #111827;
    color: #e5e7eb;
    border: 1px solid #1f2937;
}

.ai-chat-input-area {
    padding: 8px;
    border-top: 1px solid #1f2937;
    background: #020617;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-chat-input-area textarea {
    width: 100%;
    resize: none;
    border-radius: 10px;
    border: 1px solid #374151;
    background: #020617;
    color: #e5e7eb;
    font-size: 12px;
    padding: 6px 8px;
}

.ai-chat-send {
    align-self: flex-start;
    padding: 6px 12px;
    border-radius: 999px;
    border: none;
    background: #22c55e;
    color: #f9fafb;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
}

.ai-chat-send:disabled {
    opacity: 0.6;
    cursor: default;
}



/* ===== AI Chat Widget ===== */

.ai-chat-launcher {
    position: fixed;
    bottom: 24px;
    left: 24px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #f9fafb;
    padding: 10px 16px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.8);
    z-index: 1000;
}

.ai-chat-launcher:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.ai-chat-window {
    position: fixed;
    bottom: 80px;
    left: 24px;
    width: 320px;
    max-height: 420px;
    background: #020617;
    border-radius: 16px;
    border: 1px solid #1f2937;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.9);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
}

.ai-chat-window.open {
    display: flex;
}

.ai-chat-header {
    padding: 10px 12px;
    background: #020617;
    border-bottom: 1px solid #1f2937;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #e5e7eb;
}

.ai-chat-close {
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
}

.ai-chat-messages {
    flex: 1;
    padding: 8px 10px;
    overflow-y: auto;
    background: #020617;
}

.ai-chat-message {
    margin-bottom: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.ai-chat-message.from-user {
    background: #1d4ed8;
    color: #f9fafb;
    align-self: flex-end;
}

.ai-chat-message.from-bot {
    background: #111827;
    color: #e5e7eb;
    border: 1px solid #1f2937;
}

.ai-chat-input-area {
    padding: 8px;
    border-top: 1px solid #1f2937;
    background: #020617;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-chat-input-area textarea {
    width: 100%;
    resize: none;
    border-radius: 10px;
    border: 1px solid #374151;
    background: #020617;
    color: #e5e7eb;
    font-size: 12px;
    padding: 6px 8px;
}

.ai-chat-send {
    align-self: flex-start;
    padding: 6px 12px;
    border-radius: 999px;
    border: none;
    background: #22c55e;
    color: #f9fafb;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
}

.ai-chat-send:disabled {
    opacity: 0.6;
    cursor: default;
}

