/* SalesMind — Sales Pipeline Dashboard Styles */

:root {
    --primary: #1e293b;
    --blue: #085DA8;
    --cyan: #43B3E5;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { font-size: 15px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* ---- Login ---- */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #0f172a 100%);
    padding: 1rem;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo .logo-icon {
    display: inline-block;
    margin-bottom: 0.75rem;
}

.login-logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.login-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.login-error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(8, 93, 168, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 0.75rem;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover {
    background: #0a6ec0;
}

/* ---- Dashboard Layout ---- */

.dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.25rem 2rem;
}

/* ---- Header ---- */

.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-left h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.header-subtitle {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-brand {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-logout {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.15s;
}

.btn-logout:hover {
    color: var(--danger);
    border-color: var(--danger);
}

/* ---- Stats Bar ---- */

.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-prospects { background: #eff6ff; color: var(--blue); }
.icon-leads { background: #f0fdf4; color: var(--success); }
.icon-pipeline { background: #ecfeff; color: var(--cyan); }
.icon-proposals { background: #fefce8; color: var(--warning); }
.icon-revenue { background: #f0fdf4; color: var(--success); }
.icon-calls { background: #faf5ff; color: #8b5cf6; }

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--primary);
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-note {
    font-weight: 400;
    color: var(--text-light);
    font-size: 0.7rem;
}

/* ---- Cards & Grid ---- */

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.full-width {
    margin-bottom: 1.25rem;
}

.empty-note {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 2rem 0;
}

/* ---- Funnel ---- */

.funnel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.funnel-stage {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.funnel-bar-wrap {
    width: 100%;
}

.funnel-bar {
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 0.75rem;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 48px;
    transition: width 0.4s ease;
}

.funnel-bar-1 { background: linear-gradient(90deg, #085DA8, #0a6ec0); }
.funnel-bar-2 { background: linear-gradient(90deg, #0a6ec0, #1a85d4); }
.funnel-bar-3 { background: linear-gradient(90deg, #1a85d4, #43B3E5); }
.funnel-bar-4 { background: linear-gradient(90deg, #43B3E5, #5ec4ef); }
.funnel-bar-5 { background: linear-gradient(90deg, #5ec4ef, #7dd3f5); }
.funnel-bar-6 { background: linear-gradient(90deg, #10b981, #34d399); }

.funnel-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.25rem;
}

.funnel-name {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text);
}

.funnel-rate {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

/* ---- Email Stats ---- */

.email-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.email-stat {
    text-align: center;
    padding: 1rem 0.5rem;
    background: var(--bg);
    border-radius: 8px;
}

.email-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.email-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.25rem;
}

/* ---- Bar Charts ---- */

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 200px;
    padding-top: 1rem;
}

.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.bar-track {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.bar {
    width: 100%;
    max-width: 48px;
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 0.4rem;
    min-height: 8px;
    transition: height 0.4s ease;
}

.bar-leads { background: linear-gradient(180deg, var(--blue), #0a6ec0); }
.bar-revenue { background: linear-gradient(180deg, var(--success), #34d399); }

.bar-value {
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.bar-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    text-align: center;
}

/* ---- Data Table ---- */

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table .text-right {
    text-align: right;
}

/* Stage badges */
.stage-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stage-new { background: #eff6ff; color: var(--blue); }
.stage-screening { background: #fefce8; color: #b45309; }
.stage-meeting { background: #ecfeff; color: #0891b2; }
.stage-proposal { background: #faf5ff; color: #7c3aed; }
.stage-customer { background: #f0fdf4; color: #059669; }

/* ---- Activity Feed ---- */

.activity-feed {
    max-height: 500px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon-search { background: #eff6ff; color: var(--blue); }
.activity-icon-fire { background: #fff7ed; color: #ea580c; }
.activity-icon-send { background: #faf5ff; color: #7c3aed; }
.activity-icon-check-circle { background: #f0fdf4; color: var(--success); }
.activity-icon-dollar { background: #f0fdf4; color: var(--success); }
.activity-icon-calendar { background: #ecfeff; color: var(--cyan); }

.activity-body {
    flex: 1;
    min-width: 0;
}

.activity-text {
    display: block;
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.4;
}

.activity-time {
    display: block;
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 0.2rem;
}

.activity-source {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-light);
    background: var(--bg);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    align-self: center;
}

/* ---- Footer ---- */

.dash-footer {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--text-light);
    font-size: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

/* ---- Responsive ---- */

@media (max-width: 1024px) {
    .dash-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    html { font-size: 14px; }

    .stats-bar {
        grid-template-columns: 1fr 1fr;
    }

    .dash-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .chart-bars {
        height: 160px;
    }
}

@media (max-width: 480px) {
    .stats-bar {
        grid-template-columns: 1fr;
    }

    .email-stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Scrollbar styling */
.activity-feed::-webkit-scrollbar {
    width: 6px;
}

.activity-feed::-webkit-scrollbar-track {
    background: transparent;
}

.activity-feed::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.activity-feed::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}
