/* ============================================
   VELOCITY LABS DASHBOARD - CYBERPUNK THEME
   ============================================ */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a26;
    --neon-blue: #00d2ff;
    --neon-purple: #9d4edd;
    --neon-pink: #ff006e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    --gradient-primary: linear-gradient(135deg, #00d2ff 0%, #9d4edd 100%);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ============================================
   SCREENS
   ============================================ */
.screen {
    display: none !important;
}

.screen.active {
    display: flex !important;
}

/* ============================================
   LOGIN SCREEN
   ============================================ */
#login-screen.active {
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at top, rgba(0, 210, 255, 0.1) 0%, transparent 50%),
        var(--bg-primary);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 210, 255, 0.2);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.login-logo {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo .logo-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 16px;
}

.login-logo h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo p {
    color: var(--text-secondary);
    margin-top: 8px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 210, 255, 0.2);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--neon-blue);
    box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    width: 100%;
    background: var(--gradient-primary);
    color: var(--bg-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 210, 255, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(0, 210, 255, 0.3);
    color: var(--neon-blue);
}

.btn-outline:hover {
    background: rgba(0, 210, 255, 0.1);
    border-color: var(--neon-blue);
}

.btn-sm {
    padding: 10px 16px;
    font-size: 0.75rem;
}

.error-message {
    margin-top: 16px;
    padding: 12px;
    background: rgba(255, 0, 110, 0.1);
    border: 1px solid rgba(255, 0, 110, 0.3);
    border-radius: var(--radius-sm);
    color: var(--neon-pink);
    font-size: 0.9rem;
    display: none;
}

.error-message.visible {
    display: block;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(0, 210, 255, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left .logo-icon {
    font-size: 1.5rem;
}

.header-left h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-badge {
    padding: 8px 16px;
    background: rgba(0, 210, 255, 0.1);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--neon-blue);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================
   STATS SECTION
   ============================================ */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(26, 26, 38, 0.8) 100%);
    border: 1px solid rgba(0, 210, 255, 0.15);
    border-radius: var(--radius-md);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    border-color: rgba(0, 210, 255, 0.4);
    box-shadow: 0 15px 40px rgba(0, 210, 255, 0.15), 0 5px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(-4px);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:nth-child(1) .stat-icon {
    background: rgba(0, 210, 255, 0.15);
    color: var(--neon-blue);
}

.stat-card:nth-child(2) .stat-icon {
    background: rgba(0, 255, 136, 0.15);
    color: #00ff88;
}

.stat-card:nth-child(3) .stat-icon {
    background: rgba(157, 78, 221, 0.15);
    color: var(--neon-purple);
}

.stat-card:nth-child(4) .stat-icon {
    background: rgba(255, 0, 110, 0.15);
    color: var(--neon-pink);
}

.stat-icon {
    font-size: 2rem;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: transform 0.3s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1);
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* ============================================
   CUSTOMERS SECTION
   ============================================ */
.customers-section {
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 210, 255, 0.1);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid rgba(0, 210, 255, 0.1);
}

.section-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
}

.customers-table-wrapper {
    overflow-x: auto;
}

.customers-table {
    width: 100%;
    border-collapse: collapse;
}

.customers-table th,
.customers-table td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.customers-table th {
    background: var(--bg-tertiary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.customers-table tbody tr {
    transition: all 0.2s ease;
}

.customers-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(0, 210, 255, 0.08) 0%, rgba(157, 78, 221, 0.05) 100%);
    transform: scale(1.005);
}

.customers-table .loading-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    cursor: default;
}

.status-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.status-new {
    background: rgba(0, 210, 255, 0.2);
    color: var(--neon-blue);
}

.status-contacted {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.status-qualified {
    background: rgba(157, 78, 221, 0.2);
    color: var(--neon-purple);
}

.status-in_progress {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

.status-completed {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

.btn-view {
    padding: 8px 16px;
    font-size: 0.75rem;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 210, 255, 0.2);
    border-radius: var(--radius-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid rgba(0, 210, 255, 0.1);
}

.modal-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--neon-pink);
}

.modal-body {
    padding: 24px;
}

.customer-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-item label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.info-item span,
.info-item p {
    color: var(--text-primary);
    font-size: 1rem;
}

.info-item select {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 210, 255, 0.2);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.conversation-section,
.ai-prompt-section {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid rgba(0, 210, 255, 0.1);
}

.conversation-section h3,
.ai-prompt-section h3 {
    font-size: 1rem;
    margin-bottom: 16px;
}

.conversation-history {
    max-height: 300px;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.conv-message {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
}

.conv-message.inbound {
    background: rgba(0, 210, 255, 0.1);
    margin-right: 20%;
}

.conv-message.outbound {
    background: rgba(157, 78, 221, 0.1);
    margin-left: 20%;
}

.conv-message .time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.ai-prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.ai-prompt-container {
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}

.empty-state {
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .header {
        padding: 16px 20px;
    }

    .main-content {
        padding: 20px;
    }

    .customer-info-grid {
        grid-template-columns: 1fr;
    }

    .customers-table th,
    .customers-table td {
        padding: 12px 16px;
    }
}

/* ============================================
   SECTION ACTIONS
   ============================================ */
.section-actions {
    display: flex;
    gap: 12px;
}

/* ============================================
   ACTION BUTTONS IN TABLE
   ============================================ */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.75rem;
    min-width: auto;
}

.btn-danger {
    border-color: rgba(255, 0, 110, 0.3);
    color: var(--neon-pink);
}

.btn-danger:hover {
    background: rgba(255, 0, 110, 0.2);
    border-color: var(--neon-pink);
}

/* ============================================
   AI BADGES
   ============================================ */
.ai-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(0, 255, 136, 0.15);
    color: #00ff88;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.ai-badge-empty {
    color: var(--text-muted);
}

/* ============================================
   FORM GRID (Add/Edit Modal)
   ============================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 210, 255, 0.2);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--neon-blue);
    box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 210, 255, 0.1);
}

.form-actions .btn {
    width: auto;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .section-actions {
        flex-direction: column;
        gap: 8px;
    }
}