@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&display=swap');

/* =========================================
   المتغيرات العامة (Variables)
   ========================================= */
:root {
    --primary: #0e7b96;
    --primary-light: #e6f2f5;
    --text-dark: #1a2f3a;
    --text-muted: #6b8592;
    --bg-color: #f8fbfb;
    --border: #eef2f3;
    --yellow: #f2c94c;
    --danger: #e74c3c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-dark);
    direction: rtl;
}

/* =========================================
   1. شريط التنقل (Navigation)
   ========================================= */
nav {
    background: #ffffff;
    padding: 15px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-dark);
    text-decoration: none;
}

.logo span {
    color: var(--primary);
}

.logo-icon {
    background: var(--primary);
    color: white;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 15px;
    transition: 0.3s;
}

.nav-links a:hover {
    color: var(--primary);
}

/* الأزرار العامة */
.btn-primary {
    background: var(--primary);
    color: white;
    padding: 10px 24px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: #0a6077;
}

.btn-outline {
    background: transparent;
    color: var(--text-dark);
    padding: 10px 24px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    border: 1px solid #dcdcdc;
    transition: 0.3s;
}

.btn-outline:hover {
    background: #f0f0f0;
}

/* =========================================
   2. الصفحة الرئيسية (Hero Section)
   ========================================= */
.hero {
    max-width: 1200px;
    margin: 80px auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 50px;
}

.hero-text {
    flex: 1;
    max-width: 550px;
}

.eyebrow {
    color: var(--primary);
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.eyebrow::before {
    content: "";
    width: 30px;
    height: 2px;
    background: var(--primary);
}

.hero-text h1 {
    font-size: 65px;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 20px;
    letter-spacing: -1px;
}

.hero-text h1 span {
    color: var(--primary);
}

.hero-text p {
    font-size: 18px;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 40px;
}

.hero-buttons {
    display: flex;
    gap: 15px;
}

/* تصميم الرسمة الجانبية */
.hero-image {
    flex: 1;
    position: relative;
    height: 450px;
    background: #d2e9e9;
    border-radius: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.hero-image::before {
    content: "";
    position: absolute;
    width: 300px;
    height: 300px;
    background: #bde0e0;
    border-radius: 50%;
    top: -50px;
    right: -50px;
}

.hero-image::after {
    content: "";
    position: absolute;
    width: 400px;
    height: 400px;
    background: #bde0e0;
    border-radius: 50%;
    bottom: -100px;
    left: -100px;
}

.mind-map-card {
    background: #ffffff;
    width: 85%;
    height: 75%;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    z-index: 10;
    padding: 30px;
    position: relative;
    transform: rotate(-2deg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 20px;
}

.card-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 20px;
}

.line {
    height: 8px;
    background: #eef3f5;
    border-radius: 10px;
    margin-bottom: 12px;
}

.line.short {
    width: 60%;
}

.nodes {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.node {
    background: #e1f0f3;
    color: var(--primary);
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
}

.node.center {
    background: var(--primary);
    color: white;
}

.floating-tag {
    position: absolute;
    bottom: 30px;
    right: 10px;
    background: var(--yellow);
    color: #4a3d1c;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 15px;
    box-shadow: 0 10px 20px rgba(242, 201, 76, 0.3);
    z-index: 20;
}

/* =========================================
   3. صفحة الدردشة (Chat)
   ========================================= */
.chat-layout {
    max-width: 1300px;
    margin: 30px auto;
    padding: 0 20px;
    display: flex;
    gap: 20px;
    height: calc(100vh - 120px);
}

.chat-main {
    flex: 1;
    background: #ffffff;
    border-radius: 15px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.bot-icon {
    background: var(--primary-light);
    color: var(--primary);
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chat-header-title h2 {
    font-size: 18px;
    margin-bottom: 2px;
}

.chat-header-title p {
    font-size: 13px;
    color: var(--text-muted);
}

.plan-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

.chat-messages {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.chat-welcome {
    text-align: center;
    margin: auto;
    max-width: 500px;
}

.chat-welcome .brain-icon {
    background: var(--primary-light);
    color: var(--primary);
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin: 0 auto 20px;
}

.chat-welcome h3 {
    font-size: 24px;
    margin-bottom: 10px;
}

.chat-welcome p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 25px;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.chip {
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.3s;
}

.chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* الرسائل */
.message {
    display: flex;
    margin-bottom: 20px;
}

.message.user {
    justify-content: flex-start;
}

.message.ai {
    justify-content: flex-end;
}

.message-content {
    max-width: 75%;
    padding: 15px 20px;
    border-radius: 15px;
    line-height: 1.6;
    font-size: 15px;
    white-space: pre-wrap;
}

.message.user .message-content {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.message.ai .message-content {
    background: #f4f7f9;
    color: var(--text-dark);
    border-bottom-left-radius: 2px;
}

/* منطقة الإدخال */
.chat-input-area {
    padding: 20px;
    border-top: 1px solid var(--border);
    background: #ffffff;
}

.tools-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.tool-btn {
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: 0.3s;
}

.tool-btn:hover {
    background: #f8fbfb;
    border-color: var(--primary);
    color: var(--primary);
}

.input-box {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.input-box textarea {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    font-family: inherit;
    font-size: 15px;
    resize: none;
    height: 55px;
    outline: none;
    transition: 0.3s;
}

.input-box textarea:focus {
    border-color: var(--primary);
}

.send-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 55px;
    height: 55px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: 0.3s;
}

.send-btn:hover {
    background: #0a6077;
}

/* القائمة الجانبية للدردشة */
.chat-sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.sidebar-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 20px;
}

.sidebar-card h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.sidebar-tool {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f4f7f9;
}

.sidebar-tool:last-child {
    border-bottom: none;
}

.tool-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
}

.tool-icon {
    background: var(--primary-light);
    color: var(--primary);
    width: 35px;
    height: 35px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-action-btn {
    background: transparent;
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-muted);
}

.upload-area {
    border: 2px dashed #dce4e8;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 10px;
}

.upload-area label {
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
}

.upload-area input {
    display: none;
}

.usage-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 8px;
}

.usage-bar-bg {
    height: 8px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

.usage-bar-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
}

.pricing-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.pricing-link:hover {
    color: var(--primary);
}

/* =========================================
   4. صفحة الباقات (Pricing)
   ========================================= */
.pricing-header {
    text-align: right;
    max-width: 1000px;
    margin: 50px auto 40px;
    padding: 0 20px;
}

.pricing-header h1 {
    font-size: 38px;
    font-weight: 900;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.pricing-header p {
    color: var(--text-muted);
    font-size: 16px;
}

.pricing-grid-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto 50px;
    padding: 0 20px;
    flex-wrap: wrap;
}

.pricing-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px;
    flex: 1;
    min-width: 260px;
    max-width: 280px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
}

.pricing-card.active {
    border: 2px solid var(--primary);
    background: #f4fafb;
    box-shadow: 0 10px 30px rgba(14, 123, 150, 0.08);
}

.pricing-card h3 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge-current {
    background: #dff0f3;
    color: var(--primary);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
}

.pricing-price {
    font-size: 36px;
    font-weight: 900;
    color: var(--text-dark);
    margin-bottom: 10px;
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.pricing-price span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.pricing-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    min-height: 60px;
}

.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
    flex-grow: 1;
}

.pricing-features li {
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.pricing-features li i {
    color: var(--primary);
    font-size: 12px;
    margin-top: 5px;
}

.btn-plan {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    border: 1px solid #dcdcdc;
    background: transparent;
    color: var(--text-dark);
    transition: 0.3s;
    display: block;
    text-decoration: none;
}

.btn-plan:hover {
    background: #f5f7f9;
}

.btn-plan.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-plan.primary:hover {
    background: #0a6077;
}

/* =========================================
   5. لوحة التحكم (Dashboard)
   ========================================= */
.dashboard-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 30px;
}

.dash-header h1 {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.dash-header p {
    color: var(--text-muted);
    font-size: 15px;
}

.dash-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.dash-left, .dash-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.welcome-card {
    background: #e0f2f4;
    border-radius: 16px;
    padding: 30px;
    position: relative;
    overflow: hidden;
}

.welcome-card h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 10px;
    position: relative;
    z-index: 2;
}

.welcome-card p {
    color: var(--text-muted);
    font-size: 14px;
    position: relative;
    z-index: 2;
}

.welcome-card::after {
    content: "";
    position: absolute;
    bottom: -50px;
    left: 20px;
    width: 150px;
    height: 150px;
    border: 20px solid #cce6e9;
    border-radius: 50%;
    z-index: 1;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card h3 {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.stat-card p {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
}

.recent-chats {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.recent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.recent-header h3 {
    font-size: 18px;
    font-weight: 800;
}

.recent-header a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: 0.3s;
}

.recent-header a:hover {
    color: var(--primary);
}

.empty-state {
    margin: auto;
    text-align: center;
}

.empty-state i {
    font-size: 30px;
    color: #dce4e8;
    margin-bottom: 15px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 20px;
}

.btn-small {
    background: var(--primary);
    color: white;
    padding: 8px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    display: inline-block;
}

.side-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px;
}

.side-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.side-card-header h3 {
    font-size: 16px;
    font-weight: 800;
}

.side-card-header span {
    background: var(--border);
    color: var(--text-dark);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.usage-big-number {
    font-size: 40px;
    font-weight: 900;
    color: var(--text-dark);
    line-height: 1;
    margin-bottom: 5px;
}

.usage-big-number span {
    font-size: 20px;
    color: var(--text-muted);
    font-weight: 600;
}

.usage-label {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 20px;
}

.usage-bar {
    height: 8px;
    background: var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: var(--primary);
    width: 5%;
    border-radius: 10px;
}

.usage-status {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 25px;
}

.btn-full {
    display: block;
    width: 100%;
    padding: 12px;
    text-align: center;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    transition: 0.3s;
}

.btn-solid {
    background: var(--primary);
    color: white;
}

.btn-solid:hover {
    background: #0a6077;
}

.ready-card h3 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 5px;
}

.ready-card p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.6;
}

.btn-light {
    background: #e6f2f5;
    color: var(--primary);
}

.btn-light:hover {
    background: #d2e9e9;
}

/* =========================================
   6. صفحة الدخول والتسجيل (Auth)
   ========================================= */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    background: var(--bg-color);
    padding: 20px;
}

.auth-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 10px 30px rgba(14, 123, 150, 0.05);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 15px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

.form-group input {
    padding: 12px 15px;
    border: 1px solid #dce4e8;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: 0.3s;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 123, 150, 0.1);
}

.auth-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 10px;
}

.auth-btn:hover {
    background: #0a6077;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.register-fields {
    display: none;
}

.show-register .register-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* =========================================
   7. التجاوب مع الشاشات الصغيرة (Responsive)
   ========================================= */
@media (max-width: 900px) {
    .hero, .chat-layout, .dash-grid {
        flex-direction: column;
        height: auto;
    }
    
    .hero-text h1 {
        font-size: 45px;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    .chat-sidebar {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .dash-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    nav {
        padding: 15px 20px;
    }
    
    .nav-links {
        display: none; /* إخفاء الروابط في الهواتف لتوفير المساحة */
    }
}

@media (max-width: 600px) {
    .chat-sidebar {
        grid-template-columns: 1fr;
    }
    .pricing-grid-container {
        flex-direction: column;
        align-items: center;
    }
}