/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
    /* Colors */
    --bg-dark: #070913;
    --bg-card: rgba(15, 22, 42, 0.45);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.3);
    --primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
    
    --secondary: #06b6d4;
    --secondary-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    
    /* Font Families */
    --font-en: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-ar: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-current: var(--font-en);
    
    /* Layout & UI constants */
    --sidebar-width: 260px;
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* RTL Layout Modifications */
html[dir="rtl"] {
    --font-current: var(--font-ar);
}

/* ==========================================================================
   BASE & RESET STYLES
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-current);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

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

/* ==========================================================================
   AMBIENT BACKGROUND ANIMATIONS
   ========================================================================== */
.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(1px 1px at 20px 30px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 40px 70px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 90px 110px, rgba(255,255,255,0.7), rgba(0,0,0,0)),
        radial-gradient(1px 1px at 150px 200px, #ffffff, rgba(0,0,0,0));
    background-repeat: repeat;
    background-size: 200px 200px;
    opacity: 0.15;
    z-index: -3;
    pointer-events: none;
}

.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.2;
    z-index: -2;
    pointer-events: none;
    animation: float 20s infinite alternate ease-in-out;
}

.orb-1 {
    top: -10%;
    right: 10%;
    width: 45vw;
    height: 45vw;
    background: radial-gradient(circle, var(--primary) 0%, rgba(0,0,0,0) 70%);
}

.orb-2 {
    bottom: -10%;
    left: 5%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--secondary) 0%, rgba(0,0,0,0) 70%);
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 30px) scale(1.1); }
}

/* ==========================================================================
   APP LAYOUT & STRUCTURE
   ========================================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
    padding-left: var(--sidebar-width);
}

html[dir="rtl"] .app-container {
    padding-left: 0;
    padding-right: var(--sidebar-width);
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(10, 15, 30, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    transition: var(--transition-smooth);
}

html[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding-left: 10px;
}

html[dir="rtl"] .brand {
    padding-left: 0;
    padding-right: 10px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.brand-name {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius-md);
    font-weight: 500;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.nav-item i {
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

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

.nav-item.active {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0.03) 100%);
    border-color: rgba(139, 92, 246, 0.25);
    color: #c084fc;
}

html[dir="rtl"] .nav-item.active {
    background: linear-gradient(-90deg, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0.03) 100%);
}

.nav-item.active i {
    color: #c084fc;
}

.sidebar-footer {
    margin-top: auto;
}

/* Language Toggle Button */
.lang-toggle-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-smooth);
}

.lang-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
}

/* Main Content Wrapper */
.main-content {
    flex-grow: 1;
    margin-left: 0;
    padding: 40px;
    max-width: 100%;
    min-width: 0; /* Crucial for nested scrollable tables to not expand the parent */
    transition: var(--transition-smooth);
}

html[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: 0;
}

/* Top Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    gap: 20px;
}

.top-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* API Status Badge */
.api-status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.badge-offline {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}
.badge-offline .status-dot { background: var(--text-muted); }

.badge-demo {
    background: var(--warning-bg);
    border-color: rgba(245, 158, 11, 0.25);
    color: #fbbf24;
}
.badge-demo .status-dot { 
    background: var(--warning); 
    box-shadow: 0 0 10px var(--warning);
}

.badge-online {
    background: var(--success-bg);
    border-color: rgba(16, 185, 129, 0.25);
    color: #34d399;
}
.badge-online .status-dot { 
    background: var(--success); 
    box-shadow: 0 0 10px var(--success);
}

/* ==========================================================================
   VIEWS CONTAINER
   ========================================================================== */
.view-container {
    display: none;
    flex-direction: column;
    gap: 30px;
}

.view-container.active {
    display: flex;
    animation: fadeIn 0.4s ease-out;
}

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

/* ==========================================================================
   STATISTICS CARD GRID
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--border-hover);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.icon-purple {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}
.icon-green {
    background: var(--success-bg);
    color: #34d399;
}
.icon-yellow {
    background: var(--warning-bg);
    color: #fbbf24;
}
.icon-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.stat-data h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-data p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.stat-glow {
    position: absolute;
    bottom: -20px;
    right: -20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    filter: blur(30px);
    opacity: 0.1;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.stat-card:hover .stat-glow {
    opacity: 0.3;
    transform: scale(1.5);
}

.icon-purple ~ .stat-glow { background: var(--primary); }
.icon-green ~ .stat-glow { background: var(--success); }
.icon-yellow ~ .stat-glow { background: var(--warning); }
.icon-blue ~ .stat-glow { background: var(--secondary); }

/* ==========================================================================
   GLASS CARDS & PANELS
   ========================================================================== */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

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

.panel-header i {
    font-size: 1.3rem;
    color: var(--primary);
}

.panel-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

/* ==========================================================================
   FORM COMPONENTS
   ========================================================================== */
.responsive-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    align-items: flex-end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 15px;
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}

html[dir="rtl"] .input-icon {
    left: auto;
    right: 15px;
}

.input-wrapper input, .input-wrapper select {
    width: 100%;
    padding: 14px 16px 14px 44px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    outline: none;
}

html[dir="rtl"] .input-wrapper input, html[dir="rtl"] .input-wrapper select {
    padding: 14px 44px 14px 16px;
}

.input-wrapper input:focus, .input-wrapper select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
    background: rgba(15, 23, 42, 0.8);
}

.toggle-password-btn {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

html[dir="rtl"] .toggle-password-btn {
    right: auto;
    left: 15px;
}

.toggle-password-btn:hover {
    color: var(--text-primary);
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: var(--border-radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(139, 92, 246, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

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

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

.btn-danger-outline {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.btn-danger-outline:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: var(--border-radius-sm);
}

.btn:disabled, .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   LEADS SECTION & CONTROLS
   ========================================================================== */
.leads-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 25px;
}

.leads-header-controls .header-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.leads-header-controls .header-title i {
    font-size: 1.3rem;
    color: var(--secondary);
}

.leads-header-controls .header-title h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.actions-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Search and Filter Inputs */
.search-box {
    position: relative;
    width: 200px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

html[dir="rtl"] .search-icon {
    left: auto;
    right: 12px;
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-smooth);
}

html[dir="rtl"] .search-box input {
    padding: 8px 34px 8px 12px;
}

.search-box input:focus {
    border-color: var(--secondary);
    background: rgba(255, 255, 255, 0.08);
}

.filter-box select {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.filter-box select:focus {
    border-color: var(--secondary);
}

.export-buttons {
    display: flex;
    gap: 8px;
}

/* ==========================================================================
   LEADS DATA TABLE
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.leads-table {
    width: 100%;
    min-width: 1000px; /* Prevent squishing of table elements on medium-to-small screens */
    table-layout: fixed; /* Enforce column widths and word wrapping */
    border-collapse: collapse;
    text-align: left;
}

html[dir="rtl"] .leads-table {
    text-align: right;
}

.leads-table th, .leads-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    word-break: break-word; /* Wrap long business names, links or addresses safely */
    white-space: normal;
}

.leads-table th {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leads-table tbody tr {
    transition: var(--transition-smooth);
}

.leads-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.leads-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table Content Classes */
.lead-company-cell {
    font-weight: 600;
    color: var(--text-primary);
}

.lead-contact-cell {
    display: block;
}

.lead-contact-cell span {
    font-size: 0.85rem;
    display: block; /* Use block to separate rows cleanly */
    margin-bottom: 6px;
    color: var(--text-secondary);
    word-break: break-all; /* Wrap long emails/urls safely */
}

.lead-contact-cell span svg {
    vertical-align: middle;
    margin-right: 5px;
    flex-shrink: 0;
}

html[dir="rtl"] .lead-contact-cell span svg {
    margin-right: 0;
    margin-left: 5px;
}

.lead-contact-cell a {
    color: var(--secondary);
    text-decoration: none;
    word-break: break-all;
}

/* Rating badge & Stars */
.rating-cell-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rating-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
}

.rating-badge.rating-high {
    background: var(--success-bg);
    color: #34d399;
}

.rating-badge.rating-mid {
    background: var(--warning-bg);
    color: #fbbf24;
}

.rating-badge.rating-low {
    background: var(--danger-bg);
    color: #f87171;
}

.table-stars {
    color: #eab308;
    font-size: 0.75rem;
    display: flex;
    gap: 2px;
}

/* Lead Score Badges */
.score-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
}

.score-badge.score-hot {
    background: var(--danger-bg);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.score-badge.score-warm {
    background: var(--warning-bg);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.score-badge.score-cold {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Action Buttons in Table */
.table-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-icon.btn-view:hover {
    color: var(--secondary);
    border-color: rgba(6, 182, 212, 0.3);
    background: rgba(6, 182, 212, 0.08);
}

.btn-icon.btn-delete:hover {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
}

/* Empty State / Loading State */
.empty-state-row td {
    padding: 0;
}

.empty-state {
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
    max-width: 400px;
    margin: 0 auto;
}

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

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

/* ==========================================================================
   MODAL DIALOG (DETAILS VIEW)
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 7, 15, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    padding: 40px;
    transform: translateY(30px) scale(0.98);
    transition: var(--transition-smooth);
}

.modal-backdrop.active .modal-container {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 25px;
    right: 25px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

html[dir="rtl"] .modal-close {
    right: auto;
    left: 25px;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 25px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.modal-title-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-title-area h2 {
    font-size: 1.8rem;
    font-weight: 800;
}

.modal-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.modal-rating-area {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

html[dir="rtl"] .modal-rating-area {
    align-items: flex-start;
}

.rating-stars {
    color: #eab308;
    margin-bottom: 4px;
    display: flex;
    gap: 2px;
}

.rating-val {
    font-size: 1.3rem;
    font-weight: 700;
}

.rating-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Modal Layout Grid */
.modal-body-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.modal-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.modal-col.flex-col {
    height: 100%;
}

.modal-col h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    color: var(--text-primary);
}

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

.contact-info-list li {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
}

.contact-info-list li i:first-child, .contact-info-list li svg:first-child {
    color: var(--secondary);
    width: 24px;
    height: 20px;
    flex-shrink: 0;
}

.contact-info-list li div {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.contact-info-list li div small {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.contact-info-list li div span, .contact-info-list li div a {
    font-size: 0.95rem;
    font-weight: 500;
    word-break: break-all;
}

.contact-info-list li div a {
    color: var(--secondary);
    text-decoration: none;
}

.contact-info-list li div a:hover {
    text-decoration: underline;
}

.contact-info-list li .btn-icon {
    flex-shrink: 0;
}

/* AI Insights Panel in Modal */
.insights-box {
    background: rgba(139, 92, 246, 0.04);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: var(--border-radius-lg);
    padding: 20px;
}

.insights-box h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #c084fc;
    margin-bottom: 10px;
}

.pain-points-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 5px;
}

html[dir="rtl"] .pain-points-list {
    padding-left: 0;
    padding-right: 5px;
}

.pain-points-list li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    position: relative;
    padding-left: 20px;
    line-height: 1.4;
}

html[dir="rtl"] .pain-points-list li {
    padding-left: 0;
    padding-right: 20px;
}

.pain-points-list li::before {
    content: "•";
    color: #f87171;
    position: absolute;
    left: 0;
    top: -2px;
    font-size: 1.3rem;
}

html[dir="rtl"] .pain-points-list li::before {
    left: auto;
    right: 0;
}

.services-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.service-tag {
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.2);
    color: #22d3ee;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Email Pitch Column styling */
.pitch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.pitch-header h3 {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.pitch-editor-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 350px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    padding: 5px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

.pitch-textarea {
    width: 100%;
    flex-grow: 1;
    background: transparent;
    border: none;
    resize: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    padding: 15px;
    outline: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

body.rtl .pitch-textarea {
    direction: rtl;
    text-align: right;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

html[dir="rtl"] .toast-container {
    right: auto;
    left: 30px;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-left: 4px solid var(--primary);
    padding: 14px 18px;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
    transform: translateY(20px);
    opacity: 0;
    animation: toastIn 0.3s forwards;
    transition: var(--transition-smooth);
}

html[dir="rtl"] .toast {
    border-left: none;
    border-right: 4px solid var(--primary);
}

.toast.toast-success { border-color: var(--success); }
.toast.toast-danger { border-color: var(--danger); }
.toast.toast-warning { border-color: var(--warning); }

.toast-icon {
    font-size: 1.1rem;
}

.toast.toast-success .toast-icon { color: var(--success); }
.toast.toast-danger .toast-icon { color: var(--danger); }
.toast.toast-warning .toast-icon { color: var(--warning); }

.toast-message {
    font-size: 0.9rem;
    font-weight: 500;
    flex-grow: 1;
}

.toast-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.toast-close-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

@keyframes toastIn {
    to { transform: translateY(0); opacity: 1; }
}

.toast.toast-out {
    animation: toastOut 0.3s forwards;
}

@keyframes toastOut {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-20px); opacity: 0; }
}

/* ==========================================================================
   MARGIN UTILITIES
   ========================================================================== */
.margin-top { margin-top: 24px; }
.margin-top-sm { margin-top: 12px; }
.margin-bottom { margin-bottom: 24px; }
.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ==========================================================================
   RESPONSIVE LAYOUT MEDIA QUERIES
   ========================================================================== */

/* Tablet & Smaller Desktop Screens */
@media (max-width: 1024px) {
    .modal-body-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .pitch-editor-container {
        min-height: 280px;
    }
}

/* Small Screens (Mobile / Tablet Portrait) */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-left: none;
        border-bottom: 1px solid var(--border-color);
        padding: 15px 20px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    html[dir="rtl"] .sidebar {
        border-left: none;
    }
    
    .brand {
        margin-bottom: 0;
        padding-left: 0;
        padding-right: 0;
    }
    
    .nav-menu {
        flex-direction: row;
        gap: 6px;
        flex-grow: 1;
        justify-content: center;
    }
    
    .nav-item {
        padding: 6px 10px;
        font-size: 0.75rem;
        gap: 4px;
        flex-direction: column;
        align-items: center;
        flex: 1;
        text-align: center;
    }
    
    .nav-item span {
        display: block; /* Keep text visible on mobile! */
        font-size: 0.7rem;
    }
    
    .sidebar-footer {
        margin-top: 0;
        width: auto;
        flex-shrink: 0;
    }
    
    .lang-toggle-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
        flex-direction: column;
        gap: 4px;
    }
    
    .lang-toggle-btn span {
        display: block; /* Keep text visible on mobile! */
        font-size: 0.7rem;
    }
    
    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 20px;
    }
    
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 25px;
    }
    
    .top-header h1 {
        font-size: 1.8rem;
    }
    
    .api-status-badge {
        align-self: flex-start;
    }
    
    .responsive-form {
        grid-template-columns: 1fr;
    }
    
    .leads-header-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .actions-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-box {
        width: 100%;
        max-width: 250px;
        flex-grow: 1;
    }
    
    .modal-container {
        padding: 25px 20px;
    }
}

/* Extra Small Phones */
@media (max-width: 480px) {
    .actions-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: none;
    }
    
    .filter-box select {
        width: 100%;
    }
    
    .export-buttons {
        justify-content: space-between;
    }
    
    .export-buttons .btn {
        flex-grow: 1;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
    
    .stat-data h3 {
        font-size: 1.4rem;
    }
}
