/* Mostasharak custom HSL style sheet */
:root {
    --bg-dark: #0b0f19;
    --card-bg: rgba(17, 24, 39, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --primary-accent: #8b5cf6; /* Violet */
    --primary-hover: #a78bfa;
    --success: #10b981; /* Emerald */
    --danger: #ef4444; /* Rose */
    --warning: #f59e0b; /* Amber */
    --font-ar: 'Cairo', sans-serif;
    --font-en: 'Outfit', sans-serif;
}

[lang="en"] {
    direction: ltr;
    text-align: left;
}

[lang="ar"] {
    direction: rtl;
    text-align: right;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: all 0.25s ease;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-ar);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body.lang-en {
    font-family: var(--font-en);
}

/* Premium background gradient */
.glass-bg {
    position: absolute;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    background: radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.1) 0%, transparent 45%);
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Glassmorphism card template */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    margin-bottom: 2rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.accent {
    color: var(--primary-accent);
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

h1, h2, h3, h4 {
    font-weight: 700;
}

p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Navbar styles */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.75rem;
}

.logo-img {
    height: 52px;
    width: auto;
    border-radius: 8px;
    object-fit: contain;
}

.logo-text-group {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    justify-content: center;
}

.logo-text-ar {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-text-en {
    font-size: 0.9rem;
    font-weight: 600;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.badge {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid var(--primary-accent);
    color: var(--text-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* General Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-primary {
    background: var(--primary-accent);
    color: #fff;
    box-shadow: 0 4px 14px 0 rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(139, 92, 246, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(16, 185, 129, 0.5);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-block {
    display: flex;
    width: 100%;
    margin-top: 1rem;
}

.btn-toggle {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
}

.btn-toggle.active {
    background: var(--primary-accent);
    color: #fff;
    border-color: var(--primary-accent);
}

/* Onboarding Section Styles */
.onboarding-choices {
    display: flex;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.form-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

input, select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.added-stocks-container {
    margin: 1.5rem 0;
}

.added-stocks-container ul {
    list-style: none;
    margin-top: 0.5rem;
}

.added-stocks-container li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 2rem;
}

.col-span-2 {
    grid-column: span 2;
}

.col-span-3 {
    grid-column: span 2; /* responsive fallback */
}

@media(min-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 2fr 1fr;
    }
    .col-span-3 {
        grid-column: span 2;
    }
}

/* Stat Cards */
.portfolio-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: 12px;
    text-align: center;
}

.stat-card span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.5rem;
}

.stat-card h3 {
    font-size: 1.4rem;
}

.positive {
    color: var(--success);
}

.negative {
    color: var(--danger);
}

.neutral {
    color: var(--text-primary);
}

/* Table styling */
.portfolio-table-container {
    overflow-x: auto;
    overflow-y: visible;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    text-align: right;
}

[lang="en"] table {
    text-align: left;
}

th, td {
    padding: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

td {
    font-size: 0.95rem;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Billing Panel Upgrades */
.current-tier-info {
    padding: 1rem 0;
}

.current-tier-info span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.current-tier-info h3 {
    margin-top: 0.25rem;
    font-size: 1.5rem;
}

.divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 1.5rem 0;
}

.upgrade-tiers {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.25rem 0;
}

.pricing-card {
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
}

.pricing-card:hover {
    border-color: var(--primary-accent);
    background: rgba(139, 92, 246, 0.05);
}

.pricing-card.selected {
    border-color: var(--primary-accent);
    background: rgba(139, 92, 246, 0.15);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

.pricing-card h4 {
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
}

.pricing-card .price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pricing-card .limit-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.cycle-select {
    margin: 1.5rem 0;
}

.cycle-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* Insights Feed List */
.sub-indicator {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--success);
    color: var(--success);
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.insights-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.insight-item {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.insight-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.insight-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.insight-title {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
}

.insight-content {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Modal Windows */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal-content {
    width: 90%;
    max-width: 450px;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 2rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.close-btn {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.close-btn:hover {
    color: var(--text-primary);
}

/* Footer Compliance */
.footer {
    padding: 2rem 1rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: rgba(11, 15, 25, 0.4);
}

.footer p {
    font-size: 0.8rem;
    max-width: 900px;
    margin: 0 auto;
}

/* Helpers */
.hidden {
    display: none !important;
}

.text-secondary {
    color: var(--text-secondary);
}

/* Alerts and Broadcast Center layouts */
.alerts-layout, .broadcast-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
}

@media(min-width: 768px) {
    .alerts-layout, .broadcast-layout {
        grid-template-columns: 1.2fr 1.8fr;
    }
}

/* Custom Active Alerts List */
.active-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.active-alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.active-alert-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.active-alert-info .target-badge {
    font-weight: 700;
    color: var(--primary-accent);
}

/* Alerts Log History List */
.alerts-log-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.alert-log-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-accent);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.95rem;
}

[lang="ar"] .alert-log-item {
    border-left: 1px solid var(--border-color);
    border-right: 4px solid var(--primary-accent);
}

.alert-log-item.bullish {
    border-left-color: var(--success);
}
[lang="ar"] .alert-log-item.bullish {
    border-right-color: var(--success);
}

.alert-log-item.bearish {
    border-left-color: var(--danger);
}
[lang="ar"] .alert-log-item.bearish {
    border-right-color: var(--danger);
}

.alert-log-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.alert-log-text {
    line-height: 1.5;
}

/* Broadcast styles */
.broadcast-filters {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.broadcast-message-area {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.broadcast-message-area textarea:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}



/* Mostasharak-Vibe Specific Styles */
.vibe-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
}

@media(min-width: 768px) {
    .vibe-layout {
        grid-template-columns: 1.2fr 1.8fr;
    }
}

.signal-buy {
    color: #10b981 !important; /* Green */
    font-weight: 700;
}

.signal-sell {
    color: #ef4444 !important; /* Red */
    font-weight: 700;
}

.vote-buy {
    color: #10b981 !important;
    font-weight: 700;
}

.vote-sell {
    color: #ef4444 !important;
    font-weight: 700;
}

.vote-neutral {
    color: var(--text-secondary);
}

.vibe-setup-column textarea:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

/* Tooltip Icon styling */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    font-size: 10px;
    color: var(--text-secondary);
    cursor: help;
    margin-left: 4px;
    margin-right: 4px;
    position: relative;
    font-weight: bold;
}
.tooltip-icon:hover {
    background: var(--primary-accent);
    color: var(--text-primary);
}

/* Tooltip Popup */
.tooltip-icon::after {
    content: attr(data-tooltip-ar);
    position: absolute;
    bottom: 135%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(11, 15, 25, 0.95);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: normal;
    width: 200px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    line-height: 1.4;
    font-weight: normal;
}

body.lang-en .tooltip-icon::after {
    content: attr(data-tooltip-en);
}

.tooltip-icon:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}

/* TradingView integration styles */
.ticker-clickable {
    cursor: pointer;
    color: var(--primary-accent);
    text-decoration: underline;
    text-decoration-style: dotted;
    transition: color 0.15s ease, text-shadow 0.15s ease;
}

.ticker-clickable:hover {
    color: var(--primary-hover);
    text-shadow: 0 0 8px rgba(167, 139, 250, 0.4);
}

@media(max-width: 992px) {
    .tv-modal-body {
        grid-template-columns: 1fr !important;
        grid-template-rows: 1.5fr 1fr;
        overflow-y: auto;
    }
    #tradingview-modal .modal-content {
        height: 95vh !important;
    }
    #tradingview-recommendation-gauge {
        min-height: 300px !important;
    }
}

/* Custom Gauge UI styles */
.gauge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 1rem;
    gap: 1rem;
}

.gauge-dial-outer {
    position: relative;
    width: 180px;
    height: 90px;
    overflow: hidden;
}

.gauge-dial-arc {
    width: 180px;
    height: 180px;
    border: 18px solid rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    box-sizing: border-box;
}

.gauge-dial-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 180px;
    height: 180px;
    border: 18px solid rgba(255,255,255,0.05);
    border-radius: 50%;
    border-top-color: var(--primary-accent);
    border-right-color: var(--primary-accent);
    box-sizing: border-box;
    transform: rotate(-135deg);
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.4s;
}

.gauge-dial-needle {
    position: absolute;
    bottom: 0;
    left: 87px;
    width: 6px;
    height: 80px;
    background: #ffffff;
    border-radius: 3px 3px 0 0;
    transform-origin: 3px 75px;
    transform: rotate(-90deg);
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    z-index: 2;
}

.gauge-dial-center {
    position: absolute;
    bottom: -6px;
    left: 81px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    z-index: 3;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.gauge-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 5px;
}

.gauge-action {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.2rem 1rem;
    border-radius: 6px;
}

.gauge-breakdown {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
}

.gauge-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    padding: 2px 0;
    border-bottom: 1px solid rgba(255,255,255,0.02);
}

.gauge-breakdown-row:last-child {
    border-bottom: 0;
}

.gauge-breakdown-label {
    color: var(--text-secondary);
}

.gauge-breakdown-value {
    font-weight: 600;
}

/* Authentication Section Styles */
.auth-tab.active {
    color: var(--text-primary) !important;
    border-bottom: 2px solid var(--primary-accent) !important;
    font-weight: 700;
}

.auth-tab:hover {
    color: var(--text-primary) !important;
}

.active-method {
    background: var(--primary-accent) !important;
    border-color: var(--primary-accent) !important;
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3);
}

.auth-message.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.auth-message.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.btn-block {
    width: 100%;
}

/* Tooltip styling */
.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-inline-start: 6px;
    vertical-align: middle;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    user-select: none;
}

.tooltip-icon:hover {
    background: var(--primary-accent);
    transform: scale(1.15);
}

.tooltip-text {
    visibility: hidden;
    width: 220px;
    background-color: rgba(17, 24, 39, 0.95);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1000;
    bottom: 125%; /* Position above the icon */
    left: 50%;
    margin-left: -110px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
    font-weight: normal;
    line-height: 1.4;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    white-space: normal;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(17, 24, 39, 0.95) transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

