/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Tajawal', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    direction: rtl;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    background: white;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: thin;
}

.nav-tab {
    flex: 1;
    min-width: 140px;
    padding: 18px 20px;
    border: none;
    background: white;
    color: var(--dark-color);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border-bottom: 3px solid transparent;
}

.nav-tab:hover {
    background: var(--light-color);
}

.nav-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: var(--light-color);
}

.tab-icon {
    font-size: 1.5rem;
}

.tab-text {
    font-size: 0.9rem;
}

/* Main Content */
.main-content {
    padding: 40px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

/* Section Headers */
.section-header,
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2,
.dashboard-header h2 {
    font-size: 1.8rem;
    color: var(--dark-color);
    font-weight: 700;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-ai {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Tajawal', sans-serif;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #6d28d9;
    transform: translateY(-2px);
}

.btn-ai {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    box-shadow: var(--shadow);
}

.btn-ai:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* KPI Cards */
.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.kpi-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.kpi-icon {
    font-size: 3rem;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-color);
    border-radius: 12px;
}

.kpi-info h3 {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary-color);
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.chart-container {
    background: white;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid var(--border-color);
}

.chart-container h3 {
    margin-bottom: 20px;
    color: var(--dark-color);
    font-size: 1.2rem;
}

.chart-container canvas {
    max-height: 300px;
}

/* Form Styles */
.form-section {
    background: var(--light-color);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
    font-size: 1rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Tajawal', sans-serif;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.help-text {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 6px;
}

/* SWOT Grid */
.swot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.swot-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid var(--border-color);
    transition: all 0.3s;
}

.swot-card:hover {
    box-shadow: var(--shadow-lg);
}

.swot-card h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.swot-card.strengths {
    border-right: 4px solid var(--success-color);
}

.swot-card.weaknesses {
    border-right: 4px solid var(--danger-color);
}

.swot-card.opportunities {
    border-right: 4px solid var(--primary-color);
}

.swot-card.threats {
    border-right: 4px solid var(--warning-color);
}

.swot-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.swot-input input {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
}

.swot-input button {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.swot-list {
    list-style: none;
}

.swot-list li {
    padding: 10px;
    background: var(--light-color);
    margin-bottom: 8px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.swot-list button {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
}

/* Items List */
.items-list {
    display: grid;
    gap: 20px;
}

.item-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid var(--border-color);
    transition: all 0.3s;
}

.item-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.item-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark-color);
}

.item-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-growth { background: #dbeafe; color: #1e40af; }
.badge-operational { background: #fef3c7; color: #92400e; }
.badge-financial { background: #dcfce7; color: #166534; }
.badge-customer { background: #fce7f3; color: #9f1239; }

.item-description {
    color: #64748b;
    margin-bottom: 15px;
    line-height: 1.6;
}

.item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 0.9rem;
    color: #64748b;
}

.item-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.item-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn-edit {
    background: var(--primary-color);
    color: white;
}

.btn-delete {
    background: var(--danger-color);
    color: white;
}

/* Reports */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.report-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    border: 2px solid var(--border-color);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.report-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.report-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.report-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--dark-color);
}

.report-card p {
    color: #64748b;
    font-size: 0.9rem;
}

.export-section {
    background: var(--light-color);
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 30px;
}

.export-section h3 {
    margin-bottom: 15px;
}

.report-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    border: 2px solid var(--border-color);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

/* Activities */
.recent-activities {
    background: white;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid var(--border-color);
}

.recent-activities h3 {
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.activities-list {
    display: grid;
    gap: 12px;
}

.activity-item {
    padding: 15px;
    background: var(--light-color);
    border-radius: 10px;
    border-right: 4px solid var(--primary-color);
}

.empty-state {
    text-align: center;
    color: #94a3b8;
    padding: 40px;
    font-size: 1.1rem;
}

/* AI Chat */
.ai-chat-button {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s;
    z-index: 1000;
}

.ai-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.2);
}

.ai-chat-panel {
    position: fixed;
    bottom: 100px;
    left: 30px;
    width: 400px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    z-index: 1000;
}

.ai-chat-panel.active {
    display: flex;
}

.chat-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 1.2rem;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 85%;
    line-height: 1.5;
}

.ai-message {
    background: var(--light-color);
    align-self: flex-start;
    border-right: 3px solid var(--primary-color);
}

.user-message {
    background: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-left: 3px solid #1d4ed8;
}

.chat-input {
    padding: 15px;
    border-top: 2px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
}

.chat-input button {
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
}

/* AI Insights Banner */
.ai-insights-banner {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.insights-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.insights-header h3 {
    font-size: 1.3rem;
}

.insights-header .close-btn {
    background: rgba(255, 255, 255, 0.3);
}

.insights-content {
    line-height: 1.8;
}

.insights-content ul {
    margin-top: 15px;
    padding-right: 20px;
}

.insights-content li {
    margin-bottom: 10px;
}

/* Company Info Section */
.info-badge {
    background: #fef3c7;
    color: #92400e;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.company-info-notice {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.company-info-notice h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.company-info-notice p {
    margin-bottom: 12px;
    line-height: 1.8;
}

.company-info-notice ul {
    margin-right: 25px;
    margin-top: 12px;
    margin-bottom: 12px;
}

.company-info-notice li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.privacy-note {
    background: rgba(255, 255, 255, 0.2);
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
}

.section-subtitle {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin: 25px 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.required {
    color: var(--danger-color);
    font-weight: 700;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.completion-indicator {
    margin-top: 30px;
    padding: 20px;
    background: var(--light-color);
    border-radius: 12px;
}

.completion-bar {
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.completion-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    transition: width 0.3s ease;
}

.completion-text {
    text-align: center;
    color: var(--dark-color);
    font-weight: 600;
}

/* Footer */
.footer {
    background: var(--dark-color);
    color: white;
    text-align: center;
    padding: 30px;
}

.footer p {
    margin-bottom: 10px;
}

.footer-note {
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 1.8rem;
    }

    .main-content {
        padding: 20px;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .ai-chat-panel {
        width: calc(100% - 40px);
        left: 20px;
        right: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .nav-tab {
        min-width: 120px;
        font-size: 0.85rem;
    }

    .tab-icon {
        font-size: 1.3rem;
    }
}

/* Print Styles */
@media print {
    .nav-tabs,
    .ai-chat-button,
    .ai-chat-panel,
    .btn-primary,
    .btn-secondary,
    .btn-ai,
    .item-actions {
        display: none !important;
    }

    .container {
        box-shadow: none;
    }

    body {
        background: white;
    }
}