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

:root {
    --bg-color: #ffffff;
    --card-bg: #ffffff;
    --border-color: rgba(37, 99, 235, 0.1);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --primary: #2563eb;
    --primary-glow: rgba(37, 99, 235, 0.1);
    --success: #059669;
    --success-glow: rgba(5, 150, 105, 0.12);
    --danger: #dc2626;
    --warning: #d97706;
    --gradient-purple: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    --gradient-cyan: linear-gradient(135deg, #2563eb 0%, #d3f639 100%);
    --font-sans: 'Outfit', sans-serif;
    --shadow-soft: 0 10px 30px -10px rgba(37, 99, 235, 0.06), 0 1px 3px rgba(0, 0, 0, 0.02);
}

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

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.03) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(211, 246, 57, 0.04) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    padding: 2rem 1.5rem;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

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

.logo-section h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(to right, #2563eb, #d3f639);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.logo-section p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.glow-badge {
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.25);
    color: #2563eb;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Stats Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.stat-card.leads::before {
    background: var(--gradient-cyan);
}

.stat-card.agents::before {
    background: var(--gradient-purple);
}

.stat-card.next-up::before {
    background: var(--success);
}

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

.stat-card.leads .stat-icon {
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
}

.stat-card.agents .stat-icon {
    background: rgba(211, 246, 57, 0.2);
    color: #7b9c02;
}

.stat-card.next-up .stat-icon {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.stat-info .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-info .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dashboard Layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr 1.6fr;
    }
}

/* Glassmorphism Card Style */
.panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    height: fit-content;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-title {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

.form-control {
    width: 100%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn {
    width: 100%;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 8px;
    color: white;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--gradient-purple);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: var(--gradient-cyan);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    color: #0f172a !important; /* dark text for contrast on yellow-green gradient */
}

.btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

/* Agent List */
.agent-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.agent-card {
    background: rgba(0, 0, 0, 0.015);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.agent-card:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

.agent-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.agent-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.agent-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.agent-stats-badge {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.06);
    transition: .3s;
    border-radius: 24px;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--success);
    border-color: var(--success);
}

input:checked+.slider:before {
    transform: translateX(20px);
    background-color: white;
}

/* Leads Table/Log styling */
.leads-table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(0, 0, 0, 0.005);
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.leads-table th {
    background: rgba(0, 0, 0, 0.015);
    padding: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leads-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
}

.leads-table tr:hover td {
    background: rgba(0, 0, 0, 0.015);
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-new {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-agent {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-unassigned {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Status Badge Styles */
.badge-status {
    text-transform: capitalize;
}

.status-nouveau {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.status-en-cours {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-injoignable {
    background: rgba(156, 163, 175, 0.15);
    color: #d1d5db;
    border: 1px solid rgba(156, 163, 175, 0.3);
}

.status-relance {
    background: rgba(139, 92, 246, 0.15);
    color: #c084fc;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.status-rappel-personnel {
    background: rgba(236, 72, 153, 0.15);
    color: #f472b6;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.status-deal {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-non-conforme {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Highlight Animation for newly distributed lead */
@keyframes highlight-pulse {
    0% {
        background-color: rgba(99, 102, 241, 0.4);
    }

    100% {
        background-color: transparent;
    }
}

.new-lead-flash {
    animation: highlight-pulse 2s ease-out;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Split content layouts */
.simulation-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .simulation-section {
        grid-template-columns: 1fr 1fr;
    }
}

/* Login Page Custom Styling */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 1rem;
}

.login-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-purple);
}

/* Agent Actions Button Styles */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.02) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-action:hover {
    background: rgba(0, 0, 0, 0.06) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    transform: scale(1.1);
}

.edit-agent-btn:hover {
    color: var(--primary) !important;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.delete-agent-btn:hover {
    color: var(--danger) !important;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

/* Navigation Tabs Styling */
.nav-tabs-container {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.nav-tabs {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.02);
}

.nav-link.active {
    color: #ffffff !important;
    background: var(--gradient-purple);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);
}

/* Tab Panels Animation */
.tab-panel {
    animation: tabFadeIn 0.35s ease;
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Agents Tab Grid Layout */
.agents-grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 992px) {
    .agents-grid-layout {
        grid-template-columns: 1fr 1fr;
    }
}

/* Chat Layout & Components */
.chat-container-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    min-height: 720px;
}

@media (min-width: 768px) {
    .chat-container-layout.has-sidebar {
        grid-template-columns: 280px 1fr;
    }
}

.chat-sidebar {
    height: 720px;
    overflow-y: auto;
}

.chat-window-panel {
    display: flex;
    flex-direction: column;
    height: 720px;
}

.emoji-btn {
    transition: transform 0.15s ease;
}

.emoji-btn:hover {
    transform: scale(1.3);
}

.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
    position: relative;
    animation: messagePop 0.2s ease-out;
}

@keyframes messagePop {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.message-sent {
    align-self: flex-end;
    background: var(--gradient-purple);
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.message-sent .message-meta {
    color: rgba(255, 255, 255, 0.7);
}

.message-received {
    align-self: flex-start;
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom-left-radius: 2px;
}

.message-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    text-align: right;
    opacity: 0.8;
}

.chat-contact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    margin-bottom: 0.5rem;
}

.chat-contact-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

.chat-contact-item.active {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.3);
}

.contact-name {
    font-weight: 500;
    font-size: 0.9rem;
}

/* Pulsing highlight for new leads */
.new-lead-highlight {
    background: rgba(37, 99, 235, 0.1) !important;
    border-left: 4px solid var(--primary) !important;
    animation: highlightPulse 2s infinite alternate;
}

@keyframes highlightPulse {
    from {
        background: rgba(37, 99, 235, 0.08);
    }

    to {
        background: rgba(37, 99, 235, 0.22);
    }
}

select.form-control,
select,
.status-select,
.agent-select {
    color: var(--text-primary) !important;
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
}

select option,
.form-control option,
.status-select option,
.agent-select option {
    color: var(--text-primary) !important;
    background-color: #ffffff !important;
}