@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
    --primary: #635bff;
    --primary-dark: #5048d8;
    --background: #f6f7fb;
    --sidebar: #111827;
    --white: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --green: #16a34a;
    --orange: #f59e0b;
    --purple: #8b5cf6;
    --red: #ef4444;
}

body {
    font-family: "Inter", sans-serif;
    background: var(--background);
    color: var(--text);
}

button,
input,
select,
textarea {
    font-family: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}


/* ================= LOGIN ================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at top left, rgba(99, 91, 255, 0.15), transparent 35%),
        #f5f6fa;
    padding: 20px;
}

.login-card {
    width: 420px;
    max-width: 100%;
    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 38px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.08);
}

.brand,
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    margin-bottom: 35px;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 22px;
    font-weight: 800;
}

.brand h1 {
    font-size: 21px;
}

.brand p {
    color: var(--muted);
    font-size: 12px;
}

.login-card h2 {
    font-size: 27px;
    margin-bottom: 7px;
}

.login-subtitle {
    color: var(--muted);
    margin-bottom: 28px;
}

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

.input-group label {
    font-size: 13px;
    font-weight: 600;
}

.input-group input,
.input-group select,
.input-group textarea,
.toolbar select {
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 12px 13px;
    font-size: 14px;
    outline: none;
    background: white;
    transition: 0.2s;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus,
.toolbar select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
}

.login-card .input-group {
    margin-bottom: 17px;
}

.primary-btn {
    border: none;
    background: var(--primary);
    color: white;
    padding: 11px 17px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 600;
    transition: 0.2s;
}

.primary-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.login-btn {
    width: 100%;
    margin-top: 5px;
    padding: 13px;
}

.error-message {
    color: var(--red);
    font-size: 13px;
    margin-bottom: 8px;
}

.demo-login {
    background: #f8f8ff;
    border-radius: 10px;
    padding: 14px;
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
}

.demo-login strong {
    color: var(--text);
}


/* ================= APP ================= */

.app {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 245px;
    background: var(--sidebar);
    color: white;
    padding: 25px 15px;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
}

.sidebar-brand {
    padding: 0 10px 35px;
}

.sidebar-brand h2 {
    font-size: 17px;
}

.sidebar-brand span {
    color: #9ca3af;
    font-size: 11px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    background: transparent;
    color: #9ca3af;
    border: none;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-item:hover,
.nav-item.active {
    color: white;
    background: rgba(255,255,255,0.1);
}

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

.admin-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

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

.admin-card strong {
    display: block;
    font-size: 13px;
}

.admin-card span {
    color: #9ca3af;
    font-size: 11px;
}

.logout-btn {
    width: 100%;
    background: transparent;
    color: #9ca3af;
    border: none;
    padding: 11px;
    text-align: left;
}

.logout-btn:hover {
    color: white;
}


/* ================= MAIN ================= */

.main-content {
    margin-left: 245px;
    width: calc(100% - 245px);
    min-height: 100vh;
    padding: 30px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.topbar h1 {
    font-size: 27px;
}

.topbar p {
    color: var(--muted);
    font-size: 13px;
    margin-top: 5px;
}


/* ================= SECTIONS ================= */

.section {
    display: none;
}

.active-section {
    display: block;
}


/* ================= STATS ================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.stat-icon {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
}

.stat-icon.blue {
    background: #eef2ff;
    color: #4f46e5;
}

.stat-icon.orange {
    background: #fff7ed;
    color: #ea580c;
}

.stat-icon.purple {
    background: #f5f3ff;
    color: #7c3aed;
}

.stat-icon.green {
    background: #ecfdf5;
    color: #16a34a;
}

.stat-card span {
    color: var(--muted);
    font-size: 12px;
    display: block;
}

.stat-card strong {
    font-size: 25px;
    display: block;
    margin-top: 4px;
}


/* ================= PANELS ================= */

.dashboard-grid,
.analytics-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.panel {
    background: white;
    border: 1px solid var(--border);
    border-radius: 13px;
    overflow: hidden;
}

.panel-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h2 {
    font-size: 16px;
}

.panel-header p {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}

.text-btn {
    border: none;
    background: transparent;
    color: var(--primary);
    font-weight: 600;
    font-size: 12px;
}


/* ================= RECENT LEADS ================= */

.recent-lead {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lead-main {
    display: flex;
    align-items: center;
    gap: 11px;
}

.lead-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #eef2ff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.lead-name {
    font-size: 13px;
    font-weight: 600;
}

.lead-email {
    font-size: 11px;
    color: var(--muted);
    margin-top: 3px;
}


/* ================= STATUS ================= */

.status {
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.status-new {
    background: #fff7ed;
    color: #c2410c;
}

.status-contacted {
    background: #f5f3ff;
    color: #6d28d9;
}

.status-converted {
    background: #ecfdf5;
    color: #15803d;
}


/* ================= CONVERSION ================= */

.conversion-panel {
    padding-bottom: 25px;
}

.conversion-circle {
    width: 175px;
    height: 175px;
    border-radius: 50%;
    margin: 10px auto 25px;
    background: conic-gradient(
        var(--primary) 0deg,
        var(--primary) 0deg,
        #edf0f4 0deg
    );
    display: flex;
    align-items: center;
    justify-content: center;
}

.conversion-circle > div {
    width: 130px;
    height: 130px;
    background: white;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.conversion-circle strong {
    font-size: 30px;
}

.conversion-circle span {
    font-size: 11px;
    color: var(--muted);
}

.conversion-info {
    padding: 0 25px;
}

.conversion-info > div {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted);
}

.conversion-info strong {
    margin-left: auto;
    color: var(--text);
}

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

.green-dot {
    background: var(--green);
}

.gray-dot {
    background: #d1d5db;
}


/* ================= TOOLBAR ================= */

.toolbar {
    padding: 18px;
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    flex: 1;
}

.search-box input {
    border: none;
    outline: none;
    width: 100%;
    padding: 10px 0;
    font-size: 13px;
}

.toolbar select {
    min-width: 145px;
    padding: 10px;
}


/* ================= TABLE ================= */

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

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #fafafa;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--muted);
    padding: 13px 18px;
    letter-spacing: 0.4px;
}

td {
    padding: 15px 18px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}

.table-lead {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-lead .lead-avatar {
    width: 35px;
    height: 35px;
    font-size: 12px;
}

.table-lead strong {
    display: block;
    font-size: 13px;
}

.table-lead small {
    display: block;
    color: var(--muted);
    margin-top: 3px;
}

.source {
    color: var(--muted);
}

.actions {
    display: flex;
    gap: 5px;
}

.action-btn {
    border: none;
    padding: 7px 9px;
    border-radius: 7px;
    background: #f3f4f6;
    font-size: 11px;
}

.action-btn:hover {
    background: #e5e7eb;
}

.delete-btn:hover {
    background: #fee2e2;
    color: var(--red);
}


/* ================= EMPTY ================= */

.empty-state {
    text-align: center;
    padding: 50px 20px;
}

.empty-state > div {
    font-size: 35px;
    color: var(--muted);
}

.empty-state h3 {
    margin: 10px 0 5px;
}

.empty-state p {
    color: var(--muted);
    font-size: 13px;
}


/* ================= ANALYTICS ================= */

.bar-chart {
    padding: 0 25px 30px;
}

.bar-row {
    margin-bottom: 25px;
}

.bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 8px;
}

.bar-background {
    height: 10px;
    border-radius: 10px;
    background: #f1f2f5;
    overflow: hidden;
}

.bar {
    height: 100%;
    width: 0;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.orange-bar {
    background: var(--orange);
}

.purple-bar {
    background: var(--purple);
}

.green-bar {
    background: var(--green);
}

.source-item {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
}

.source-title {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 7px;
}

.source-progress {
    height: 6px;
    background: #f1f2f5;
    border-radius: 10px;
    overflow: hidden;
}

.source-progress div {
    height: 100%;
    background: var(--primary);
    border-radius: 10px;
}


/* ================= MODAL ================= */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.modal-card {
    background: white;
    width: 620px;
    max-width: 100%;
    border-radius: 15px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 22px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 18px;
}

.modal-header p {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 7px;
    font-size: 20px;
}

#leadForm {
    padding: 22px;
}

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

.full {
    grid-column: 1 / -1;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
}

.secondary-btn {
    background: #f3f4f6;
    border: none;
    padding: 11px 17px;
    border-radius: 9px;
    font-weight: 600;
}

.secondary-btn:hover {
    background: #e5e7eb;
}


/* ================= DETAILS ================= */

.details-card {
    width: 550px;
}

.details-content {
    padding: 25px;
}

.details-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.details-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #eef2ff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
}

.details-profile h3 {
    font-size: 18px;
}

.details-profile p {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}

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

.detail-box {
    background: #f9fafb;
    padding: 14px;
    border-radius: 9px;
}

.detail-box span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 5px;
}

.detail-box strong {
    font-size: 13px;
}

.notes-box {
    margin-top: 15px;
    background: #f9fafb;
    padding: 15px;
    border-radius: 9px;
}

.notes-box span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 7px;
}

.notes-box p {
    font-size: 13px;
    line-height: 1.6;
}


/* ================= TOAST ================= */

.toast {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: #111827;
    color: white;
    padding: 13px 18px;
    border-radius: 9px;
    font-size: 13px;
    transform: translateY(100px);
    opacity: 0;
    transition: 0.3s;
    z-index: 200;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}


/* ================= RESPONSIVE ================= */

@media (max-width: 1000px) {

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

    .dashboard-grid,
    .analytics-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 750px) {

    .sidebar {
        width: 65px;
        padding: 20px 8px;
    }

    .sidebar-brand {
        justify-content: center;
        padding: 0 0 30px;
    }

    .sidebar-brand > div:last-child,
    .nav-item:not(.active) span + *,
    .nav-item {
        font-size: 0;
    }

    .nav-item span {
        font-size: 18px;
    }

    .nav-item {
        justify-content: center;
        padding: 13px;
    }

    .admin-card {
        justify-content: center;
    }

    .admin-card > div:last-child,
    .logout-btn {
        display: none;
    }

    .main-content {
        margin-left: 65px;
        width: calc(100% - 65px);
        padding: 20px;
    }

    .topbar {
        align-items: flex-start;
        gap: 15px;
    }

    .topbar h1 {
        font-size: 22px;
    }

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

    .toolbar {
        flex-direction: column;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .full {
        grid-column: auto;
    }
}

@media (max-width: 500px) {

    .main-content {
        padding: 14px;
    }

    .topbar {
        flex-direction: column;
    }

    .topbar .primary-btn {
        width: 100%;
    }

    .login-card {
        padding: 25px;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }
}