/* DESIGN SYSTEM & CUSTOM CUSTOM VARIABLES */
:root {
    --bg-main: #0b0f19;
    --bg-sidebar: #111827;
    --bg-card: rgba(22, 30, 49, 0.65);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --primary: #1877f2;
    --primary-gradient: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
    --accent: #d97706;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --font-ar: 'Cairo', sans-serif;
    --font-en: 'Outfit', sans-serif;
    
    --sidebar-width: 280px;
    --header-height: 80px;
}

/* RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-ar);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* APP CONTAINER LAYOUT */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* SIDEBAR STYLES */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    right: 0;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon i {
    font-size: 32px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 15px;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    padding: 14px 20px;
    margin-bottom: 8px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(24, 119, 242, 0.15), rgba(24, 119, 242, 0.05));
    border-right: 4px solid var(--primary);
    color: var(--primary);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-primary);
}

.user-info h4 {
    font-size: 14px;
    font-weight: 700;
}

.user-info p {
    font-size: 11px;
    color: var(--text-secondary);
}

/* MAIN AREA */
.app-main {
    flex: 1;
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 30px;
    overflow-y: auto;
}

/* MAIN HEADER */
.main-header {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-title {
    font-size: 22px;
    font-weight: 800;
}

.header-right {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.dropdown-control {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dropdown-control label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.header-select {
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 10px;
    font-family: var(--font-ar);
    font-weight: 600;
    cursor: pointer;
    min-width: 220px;
    transition: border-color 0.2s;
}

.header-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* BUTTONS */
.btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    font-family: var(--font-ar);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: none;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background-color: #166fe5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.4);
}

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

.btn-success:hover {
    background-color: #0d9488;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

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

.btn-info:hover {
    background-color: #0891b2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* CARDS WITH GLASSMORPHISM */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s, background-color 0.2s;
}

.card:hover {
    background-color: var(--bg-card-hover);
}

/* METRICS GRID */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, border-color 0.2s;
}

.metric-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.15);
}

.metric-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.bg-spent { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.bg-messages { background: linear-gradient(135deg, #b5179e, #7209b7); }
.bg-cpr { background: linear-gradient(135deg, #d97706, #f59e0b); }
.bg-orders { background: linear-gradient(135deg, #059669, #10b981); }
.bg-conv { background: linear-gradient(135deg, #0284c7, #06b6d4); }
.bg-sales { background: linear-gradient(135deg, #7c3aed, #8b5cf6); }

.metric-details h3 {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

.metric-details p {
    font-size: 24px;
    font-weight: 800;
    font-family: var(--font-en);
    margin: 2px 0;
}

.metric-details span {
    font-size: 11px;
    color: var(--text-muted);
}

.rating-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.rating-excelent { background-color: rgba(16, 185, 129, 0.2); color: #34d399; }
.rating-good { background-color: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.rating-poor { background-color: rgba(239, 68, 68, 0.2); color: #f87171; }

/* CHARTS SECTION */
.dashboard-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

.chart-card h3 {
    font-size: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-wrapper {
    position: relative;
    height: 320px;
    width: 100%;
}

/* SMART TIPS SECTION */
.smart-tips-container {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.08), rgba(22, 30, 49, 0.8));
    border: 1px solid rgba(217, 119, 6, 0.2);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
}

.smart-tips-container h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #f59e0b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tips-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tip-item {
    padding: 15px 20px;
    border-radius: 12px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
    animation: fadeIn 0.3s ease;
}

.tip-item-icon {
    font-size: 20px;
    margin-top: 2px;
}

.tip-item-content h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}

.tip-item-content p {
    font-size: 13px;
    color: var(--text-secondary);
}

.tip-danger { background-color: rgba(239, 68, 68, 0.12); border-right: 4px solid var(--danger); color: #f87171; }
.tip-warning { background-color: rgba(245, 158, 11, 0.12); border-right: 4px solid var(--warning); color: #fbbf24; }
.tip-success { background-color: rgba(16, 185, 129, 0.12); border-right: 4px solid var(--success); color: #34d399; }

/* TAB LAYOUT */
.tab-content {
    display: none;
}

.active-content {
    display: block;
    animation: fadeIn 0.4s ease;
}

.tab-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 15px;
}

/* TABLES STYLING */
.table-card {
    padding: 10px 0;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}

.data-table th, .data-table td {
    padding: 16px 20px;
    font-size: 13px;
}

.data-table th {
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--text-secondary);
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.data-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-gold { color: #f59e0b; }

.status-indicator {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.status-active { background-color: rgba(16, 185, 129, 0.2); color: var(--success); }
.status-paused { background-color: rgba(255, 255, 255, 0.1); color: var(--text-secondary); }

/* CRM MINI CRM LAYOUT */
.crm-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
}

.crm-form-card {
    align-self: start;
}

.crm-form-card h3 {
    margin-bottom: 20px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input, .form-group select, .form-group textarea {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 15px;
    border-radius: 8px;
    font-family: var(--font-ar);
    font-size: 13px;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.crm-list-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.crm-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.crm-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.form-group-inline {
    display: inline-block;
}

.search-input, .date-input, .select-input {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-family: var(--font-ar);
    font-size: 12px;
}

.search-input { width: 180px; }
.date-input { width: 130px; }
.select-input { width: 140px; }

/* ORDER STATUS SELECTOR IN CRM TABLE */
.order-status-select {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-family: var(--font-ar);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.order-status-select.status-Pending { background-color: rgba(245, 158, 11, 0.2); color: var(--warning); }
.order-status-select.status-Confirmed { background-color: rgba(6, 182, 212, 0.2); color: var(--info); }
.order-status-select.status-Shipped { background-color: rgba(59, 130, 246, 0.2); color: var(--primary); }
.order-status-select.status-Delivered { background-color: rgba(16, 185, 129, 0.2); color: var(--success); }
.order-status-select.status-Cancelled { background-color: rgba(239, 68, 68, 0.2); color: var(--danger); }

/* INSTAGRAM POSTS ANALYZER GRID */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    background-color: var(--bg-card-hover);
}

.post-media-placeholder {
    height: 160px;
    background: linear-gradient(45deg, #1e1b4b, #311042);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: rgba(255, 255, 255, 0.15);
    position: relative;
}

.post-instagram-tag {
    position: absolute;
    top: 15px;
    left: 15px;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.post-caption-box {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.post-caption-box p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.post-stats {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    font-size: 12px;
    color: var(--text-muted);
}

.post-stats span i {
    margin-left: 5px;
}

.post-action {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.1);
}

/* SETTINGS LAYOUT */
.settings-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.settings-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.setting-input {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 15px;
    border-radius: 8px;
    font-family: var(--font-en);
}

/* LINKED PAGES & AI AUTO-REPLY CSS */
.linked-pages-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.linked-page-item {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.linked-page-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.linked-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.linked-page-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.linked-page-title i {
    font-size: 24px;
    color: #1877f2; /* Facebook Blue */
}

.linked-page-title.instagram i {
    color: #e1306c; /* Instagram Pink */
}

.linked-page-title h4 {
    font-size: 18px;
    margin: 0;
    font-weight: 700;
}

.linked-page-title p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 2px 0 0 0;
}

.linked-page-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.linked-page-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.linked-page-body label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.linked-page-body textarea {
    width: 100%;
    min-height: 100px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 12px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.linked-page-body textarea:focus {
    border-color: var(--accent-color);
    outline: none;
}

.linked-page-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

/* Toggle Switch Styling */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4a5568;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #48bb78; /* Green */
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.shipping-rates-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding-left: 10px;
}

.rate-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(0,0,0,0.15);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.rate-group label {
    font-size: 13px;
    font-weight: 700;
    min-width: 80px;
}

.rate-group input {
    background-color: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    width: 100%;
    font-family: var(--font-en);
    text-align: center;
}

/* MODAL WINDOWS */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #111827;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-lg {
    max-width: 900px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 17px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal {
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

/* DIAGNOSIS DETAIL ELEMENTS */
.diagnosis-status-banner {
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
    font-weight: bold;
}

.diag-status-danger { background-color: rgba(239, 68, 68, 0.2); border: 1px solid var(--danger); color: #f87171; }
.diag-status-warning { background-color: rgba(245, 158, 11, 0.2); border: 1px solid var(--warning); color: #fbbf24; }
.diag-status-success { background-color: rgba(16, 185, 129, 0.2); border: 1px solid var(--success); color: #34d399; }

.diag-metrics-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.diag-metric-box {
    background-color: rgba(0,0,0,0.25);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.diag-metric-box h5 {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.diag-metric-box p {
    font-size: 18px;
    font-weight: 800;
    font-family: var(--font-en);
}

.diag-tips-section h4 {
    font-size: 14px;
    margin-bottom: 12px;
}

.diag-tips-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ONE CLICK AD LAUNCH PREVIEW */
.ad-preview-box {
    background-color: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
}

.ad-preview-box h5 {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.post-preview-text {
    font-size: 12px;
    white-space: pre-line;
    max-height: 120px;
    overflow-y: auto;
    color: var(--text-primary);
    background-color: rgba(0,0,0,0.2);
    padding: 10px;
    border-radius: 6px;
}

.arabic-rtl {
    direction: rtl;
    text-align: right;
}

.ad-specs-info {
    background-color: rgba(24, 119, 242, 0.08);
    border: 1px solid rgba(24, 119, 242, 0.2);
    padding: 15px;
    border-radius: 10px;
}

.ad-specs-info h5 {
    font-size: 12px;
    color: var(--primary);
    margin-bottom: 10px;
}

.ad-specs-info ul {
    list-style: none;
    font-size: 12px;
}

.ad-specs-info li {
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* POST ANALYZER SCORE SECTION */
.post-score-section {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 25px;
    background-color: rgba(255, 255, 255, 0.02);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.score-radial {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 5px solid var(--primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-radial span {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--font-en);
    line-height: 1;
}

.score-radial small {
    font-size: 10px;
    color: var(--text-secondary);
}

.score-details h4 {
    font-size: 15px;
    margin-bottom: 6px;
}

.score-details p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.post-check-indicators {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.badge-indicator {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    background-color: rgba(255,255,255,0.05);
}

.badge-ok { color: var(--success); }
.badge-missing { color: var(--danger); }

.suggestions-layout {
    display: flex;
    gap: 20px;
}

.sugg-box {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.border-gold {
    border-color: rgba(217, 119, 6, 0.4);
}

.bg-dark-card {
    background-color: rgba(0,0,0,0.3);
}

.sugg-box h4 {
    font-size: 14px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.sugg-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.sugg-box-header h4 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.suggestions-text {
    font-size: 13px;
    white-space: pre-line;
}

.flex-1 { flex: 1; }

/* TOAST NOTIFICATION */
.toast {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background-color: #1e293b;
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    display: none;
    z-index: 2000;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

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

@keyframes scaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.animate-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* RESPONSIVE DESIGN (MOBILE & TABLET) */
@media (max-width: 1200px) {
    .crm-layout {
        grid-template-columns: 1fr;
    }
    .settings-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
    .suggestions-layout {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }
    
    .app-sidebar {
        transform: translateX(280px); /* Hide drawer */
        width: 280px;
    }
    
    .app-sidebar.active-sidebar {
        transform: translateX(0); /* Show drawer */
        box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    }
    
    .app-main {
        margin-right: 0;
        padding: 20px;
    }
    
    .mobile-menu-toggle {
        display: block !important;
        background: none;
        border: none;
        color: white;
        font-size: 22px;
        cursor: pointer;
    }
    
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
    }
    
    .header-right {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-select {
        min-width: 100%;
    }
}

/* Hide hamburger on desktop */
.mobile-menu-toggle {
    display: none;
}
.no-data-alert {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.no-data-alert i {
    font-size: 28px;
    color: var(--text-muted);
}

/* BADGES AND STATUSES */
.status-badges {
    display: flex;
    gap: 8px;
    margin-right: 15px;
    align-items: center;
}
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.badge-role {
    background-color: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}
.badge-mode {
    background-color: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-mode.live {
    background-color: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* LOGIN OVERLAY */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #1e1b4b 0%, #09090b 100%);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-overlay.active {
    display: flex;
}
.login-card {
    background: rgba(22, 30, 49, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.login-card-header {
    margin-bottom: 30px;
}
.login-card-header i {
    font-size: 50px;
    margin-bottom: 15px;
}
.login-card-header h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.login-card-header p {
    font-size: 13px;
    color: var(--text-secondary);
}
.btn-block {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 14px;
    margin-top: 10px;
}
.login-error-message {
    color: var(--danger);
    font-size: 12px;
    font-weight: bold;
    margin-top: 15px;
    min-height: 18px;
}
.login-card-footer {
    margin-top: 30px;
    font-size: 11px;
    color: var(--text-muted);
}

/* LOGOUT BUTTON */
.btn-logout {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    padding: 10px 15px;
    border-radius: 10px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    font-family: var(--font-ar);
    font-size: 13px;
    font-weight: 700;
    margin-top: 15px;
    transition: all 0.2s;
}
.btn-logout:hover {
    background: var(--danger);
    color: white;
}

/* MEDIA PRINT LAYOUT */
@media print {
    body {
        background: white !important;
        color: black !important;
        font-family: var(--font-ar);
    }
    
    .app-sidebar,
    .main-header,
    .mobile-menu-toggle,
    .tab-section-header button,
    .smart-tips-container,
    .crm-form-card,
    .crm-tools,
    .modal,
    #toast,
    .no-data-alert {
        display: none !important;
    }
    
    .app-container {
        display: block !important;
    }
    
    .app-main {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    #tab-dashboard {
        display: block !important;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 15px !important;
        margin-bottom: 30px !important;
    }
    
    .metric-card {
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        color: black !important;
        box-shadow: none !important;
        page-break-inside: avoid;
        padding: 15px !important;
    }
    
    .metric-card p, .metric-card h3, .metric-card span {
        color: black !important;
    }
    
    .metric-icon {
        display: none !important;
    }
    
    .dashboard-charts {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }
    
    .chart-card {
        background: white !important;
        border: 1px solid #e2e8f0 !important;
        box-shadow: none !important;
        color: black !important;
        page-break-inside: avoid;
    }
    
    .chart-card h3 {
        color: black !important;
    }
    
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }
}

