/* ==========================================================================
   LOGIN PAGE (index.php)
   ========================================================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, rgba(108, 99, 255, 0.15), transparent 40%),
                radial-gradient(circle at bottom left, rgba(0, 217, 177, 0.1), transparent 40%),
                #0A0D14;
    position: relative;
    overflow: hidden;
}

/* Background animated grid lines */
.login-bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: 50px 50px;
    background-image: linear-gradient(to right, rgba(30, 45, 69, 0.2) 1px, transparent 1px),
                      linear-gradient(to bottom, rgba(30, 45, 69, 0.2) 1px, transparent 1px);
    z-index: 1;
}

.login-card {
    width: 100%;
    max-width: 420px;
    z-index: 10;
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), var(--glow-effect);
    text-align: center;
}

.login-logo {
    font-size: 2.2rem;
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.login-tagline {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 32px;
}

/* Shake Animation for Auth Errors */
.shake {
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}


/* ==========================================================================
   DASHBOARD PAGE (dashboard.php)
   ========================================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.kpi-icon.blue { background-color: rgba(108, 99, 255, 0.1); color: var(--primary); }
.kpi-icon.mint { background-color: rgba(0, 217, 177, 0.1); color: var(--secondary); }
.kpi-icon.orange { background-color: rgba(255, 170, 0, 0.1); color: var(--warning); }
.kpi-icon.red { background-color: rgba(255, 77, 109, 0.1); color: var(--danger); }

.kpi-details h3 {
    font-size: 1.75rem;
    margin-bottom: 4px;
    font-family: 'JetBrains Mono', monospace;
}

.kpi-details p {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Pipeline Flow Visualizer Widget */
.pipeline-card {
    margin-bottom: 32px;
}

.pipeline-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow-x: auto;
    padding: 20px 10px;
    gap: 20px;
}

.pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    cursor: pointer;
    min-width: 100px;
}

.pipeline-node {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--bg-elevated);
    border: 2px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 12px;
    transition: var(--transition);
    position: relative;
    z-index: 10;
}

.pipeline-step:hover .pipeline-node,
.pipeline-step.active .pipeline-node {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    background-color: var(--bg-surface);
}

.pipeline-step.completed .pipeline-node {
    border-color: var(--secondary);
    background-color: rgba(0, 217, 177, 0.1);
    color: var(--secondary);
}

.pipeline-node-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--primary);
    color: var(--text-primary);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-surface);
}

.pipeline-step.completed .pipeline-node-count {
    background-color: var(--secondary);
    color: var(--bg-main);
}

.pipeline-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.pipeline-step:hover .pipeline-label {
    color: var(--text-primary);
}

.pipeline-connector {
    flex-grow: 1;
    height: 2px;
    background: linear-gradient(90deg, var(--border-subtle) 50%, transparent 50%);
    background-size: 10px 2px;
    position: relative;
    min-width: 40px;
}

.pipeline-connector.active {
    background: var(--primary);
}

.pipeline-connector.completed {
    background: var(--secondary);
}

/* Animated flow dot */
.pipeline-connector.active::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: var(--primary);
    border-radius: 50%;
    top: -2px;
    left: 0;
    animation: flowDot 2s infinite linear;
    box-shadow: 0 0 8px var(--primary);
}

@keyframes flowDot {
    100% { left: 100%; }
}

/* Dashboard Bottom Grid */
.dashboard-bottom {
    display: grid;
    grid-template-columns: 2.5fr 1.5fr;
    gap: 24px;
}

/* Earnings progress tracker circular SVG */
.earnings-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.circular-progress {
    position: relative;
    width: 150px;
    height: 150px;
    margin-bottom: 20px;
}

.circular-progress svg {
    width: 150px;
    height: 150px;
    transform: rotate(-90deg);
}

.circular-progress circle {
    width: 100%;
    height: 100%;
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
}

.circular-progress .bg-circle {
    stroke: var(--border-subtle);
}

.circular-progress .fg-circle {
    stroke: url(#gradient);
    stroke-dasharray: 440;
    stroke-dashoffset: 440;
    transition: stroke-dashoffset 1s ease-out;
}

.progress-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-percentage {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Syne', sans-serif;
}

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


/* ==========================================================================
   LEADS PAGE (leads.php)
   ========================================================================== */
.leads-filter-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.leads-filter-bar .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 200px;
}

.bulk-actions-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    margin-bottom: 20px;
    display: none; /* hidden until selection */
}

.bulk-actions-left {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}


/* ==========================================================================
   ANALYZE PAGE (analyze.php)
   ========================================================================== */
.two-column-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    height: calc(100vh - 160px);
}

.queue-sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-subtle);
    padding-right: 12px;
    overflow-y: auto;
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.queue-item {
    padding: 16px;
    border-radius: 8px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: var(--transition);
}

.queue-item:hover,
.queue-item.active {
    border-color: var(--primary);
    background-color: var(--bg-elevated);
}

.queue-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.queue-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.audit-view-panel {
    overflow-y: auto;
    padding-left: 12px;
}

.opportunity-meter-container {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
}

.opportunity-score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    border: 4px solid var(--border-subtle);
}

.opportunity-score-circle.score-high { border-color: var(--secondary); color: var(--secondary); box-shadow: 0 0 15px var(--secondary-glow); }
.opportunity-score-circle.score-medium { border-color: var(--warning); color: var(--warning); box-shadow: 0 0 15px var(--warning-glow); }
.opportunity-score-circle.score-low { border-color: var(--danger); color: var(--danger); box-shadow: 0 0 15px var(--danger-glow); }

.report-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

.report-section h4 {
    margin-bottom: 12px;
    font-family: 'Syne', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
}

.report-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.audit-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
}

.audit-empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    color: var(--border-subtle);
}


/* ==========================================================================
   WEBSITE BUILDER PAGE (builder.php)
   ========================================================================== */
.builder-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    height: calc(100vh - 165px);
}

.builder-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    padding-right: 8px;
}

.builder-preview {
    background-color: #1a1a24;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.preview-bar {
    height: 48px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.preview-bar-dots {
    display: flex;
    gap: 6px;
}

.preview-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--border-subtle);
}

.preview-dot.red { background-color: var(--danger); }
.preview-dot.yellow { background-color: var(--warning); }
.preview-dot.green { background-color: var(--secondary); }

.preview-address {
    font-size: 0.75rem;
    color: var(--text-muted);
    background-color: var(--bg-main);
    padding: 4px 24px;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
    width: 50%;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-device-toggle {
    display: flex;
    gap: 8px;
}

.preview-device-btn {
    color: var(--text-muted);
    cursor: pointer;
}

.preview-device-btn.active {
    color: var(--primary);
}

.preview-iframe-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #0d0d16;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: #ffffff;
    transition: width 0.3s ease;
}

.preview-iframe.mobile {
    width: 375px;
    height: 85%;
    border-radius: 12px;
    border: 12px solid var(--bg-surface);
}

.preview-iframe.tablet {
    width: 768px;
    height: 90%;
    border-radius: 12px;
    border: 12px solid var(--bg-surface);
}


/* ==========================================================================
   DEAL CLOSER / CHAT BOARD (closer.php)
   ========================================================================== */
.closer-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    height: calc(100vh - 160px);
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: var(--transition);
}

.chat-item:hover,
.chat-item.active {
    border-color: var(--primary);
    background-color: var(--bg-elevated);
}

.chat-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-glow);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.chat-item-info {
    flex-grow: 1;
    overflow: hidden;
}

.chat-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-msg {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-window {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(10, 13, 20, 0.3);
}

.chat-body {
    flex-grow: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: rgba(10, 13, 20, 0.2);
}

/* Chat bubble styling */
.chat-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
}

.chat-bubble.sent {
    background-color: var(--primary-glow);
    color: var(--text-primary);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    border: 1px solid rgba(108, 99, 255, 0.2);
}

.chat-bubble.received {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    border: 1px solid var(--border-subtle);
}

.chat-bubble-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    justify-content: flex-end;
}

.chat-bubble.received .chat-bubble-meta {
    justify-content: flex-start;
}

.chat-sentiment-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}
.chat-sentiment-positive { background-color: var(--secondary); box-shadow: 0 0 6px var(--secondary); }
.chat-sentiment-neutral { background-color: var(--warning); box-shadow: 0 0 6px var(--warning); }
.chat-sentiment-negative { background-color: var(--danger); box-shadow: 0 0 6px var(--danger); }

.chat-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 16px;
    background-color: rgba(10, 13, 20, 0.3);
}

.chat-input-wrapper {
    flex-grow: 1;
    position: relative;
}

.chat-input {
    width: 100%;
    padding: 12px 20px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.chat-input:focus {
    border-color: var(--primary);
}

.chat-ai-helper-drawer {
    background-color: var(--bg-elevated);
    border-top: 1px solid var(--border-subtle);
    padding: 16px 24px;
    display: none;
}

.chat-ai-helper-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.chat-ai-helper-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-ai-helper-body {
    font-size: 0.85rem;
    color: var(--text-muted);
    background-color: var(--bg-main);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    white-space: pre-line;
    max-height: 150px;
    overflow-y: auto;
}


/* ==========================================================================
   SETTINGS PAGE (settings.php)
   ========================================================================== */
.settings-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 32px;
}

.settings-tabs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    list-style: none;
}

.settings-tab-btn {
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-tab-btn:hover,
.settings-tab-btn.active {
    color: var(--text-primary);
    background-color: var(--bg-surface);
}

.settings-tab-btn.active {
    color: var(--primary);
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
    background: linear-gradient(90deg, rgba(108, 99, 255, 0.08) 0%, transparent 100%);
}

.settings-content-pane {
    display: none;
}

.settings-content-pane.active {
    display: block;
}
