/* ============================================
   ALIINFX CRM - Styles
   Theme: Black, White, Gold
   Mobile-first design
   ============================================ */

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #161616;
    --bg-hover: #1e1e1e;
    --bg-input: #1a1a1a;
    --border: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --gold: #D4AF37;
    --gold-light: #e8c84d;
    --gold-dark: #b8962e;
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.12);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.12);
    --yellow: #eab308;
    --yellow-bg: rgba(234, 179, 8, 0.12);
    --blue: #3b82f6;
    --blue-bg: rgba(59, 130, 246, 0.12);
    --purple: #a855f7;
    --purple-bg: rgba(168, 85, 247, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --transition: all 0.2s ease;
}

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

html {
    -webkit-tap-highlight-color: transparent;
}

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

/* ============================================
   LAYOUT
   ============================================ */

.sidebar {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    z-index: 100;
    flex-direction: column;
    padding: 24px 16px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: var(--gold);
    color: #000;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.brand-text h1 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.brand-text span {
    font-size: 11px;
    color: var(--gold);
    font-weight: 600;
    letter-spacing: 1px;
}

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

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.sidebar-nav .nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav .nav-item.active {
    background: var(--gold);
    color: #000;
    font-weight: 600;
}

.sidebar-nav .nav-item i {
    width: 20px;
    height: 20px;
}

.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
}

.sidebar-nav .nav-item.active .nav-badge {
    background: #000;
    color: var(--gold);
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}

.sidebar-footer span {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
}

.sidebar-footer small {
    color: var(--text-muted);
}

.main-content {
    min-height: 100vh;
    padding-bottom: 80px;
}

/* ============================================
   HEADER
   ============================================ */

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
}

.menu-toggle {
    display: flex;
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 4px;
    cursor: pointer;
}

.header-title {
    flex: 1;
}

.header-title h2 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   SEARCH & FILTER
   ============================================ */

.search-bar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    animation: slideDown 0.2s ease;
}

.search-bar.active {
    display: flex;
}

.search-bar i {
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.filter-bar {
    display: none;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.filter-bar.active {
    display: block;
}

.filter-bar select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

/* ============================================
   VIEW CONTAINER
   ============================================ */

.view-container {
    padding: 16px;
}

.view {
    display: none;
    animation: fadeIn 0.25s ease;
}

.view.active {
    display: block;
}

/* ============================================
   HOME PAGE
   ============================================ */

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 8px;
    text-align: center;
    transition: var(--transition);
}

.stat-card:active {
    transform: scale(0.96);
}

.stat-number {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--gold);
    line-height: 1;
}

.stat-card.stat-overdue .stat-number {
    color: var(--red);
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 28px;
}

.quick-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 8px;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
}

.quick-btn i {
    color: var(--gold);
    width: 22px;
    height: 22px;
}

.quick-btn:active {
    background: var(--bg-hover);
    transform: scale(0.96);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 24px 0 12px;
}

.section-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-header h3 i {
    width: 16px;
    height: 16px;
}

/* ============================================
   LEAD CARDS
   ============================================ */

.lead-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lead-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.lead-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.lead-card.priority-high::before {
    background: var(--red);
}

.lead-card.priority-medium::before {
    background: var(--gold);
}

.lead-card.priority-low::before {
    background: var(--green);
}

.lead-card:active {
    background: var(--bg-hover);
}

.lead-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.lead-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lead-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.lead-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.lead-meta i {
    width: 12px;
    height: 12px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.status-new { background: var(--blue-bg); color: var(--blue); }
.status-contacted { background: var(--purple-bg); color: var(--purple); }
.status-interested { background: var(--green-bg); color: var(--green); }
.status-follow-up { background: var(--yellow-bg); color: var(--yellow); }
.status-meeting { background: var(--purple-bg); color: var(--purple); }
.status-onboarded { background: var(--green-bg); color: var(--green); }
.status-converted { background: var(--green-bg); color: var(--green); }
.status-no-reply { background: var(--red-bg); color: var(--red); }
.status-no-answer { background: var(--red-bg); color: var(--red); }
.status-not-interested { background: var(--red-bg); color: var(--red); }
.status-to-call { background: var(--blue-bg); color: var(--blue); }
.status-called { background: var(--purple-bg); color: var(--purple); }

.lead-note {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    border-left: 2px solid var(--border);
    line-height: 1.5;
}

.lead-followup {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.lead-followup i {
    width: 14px;
    height: 14px;
}

.lead-followup.overdue {
    color: var(--red);
    font-weight: 600;
}

.lead-followup.today {
    color: var(--gold);
    font-weight: 600;
}

.lead-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.lead-actions button {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
        align-items: center;
    justify-content: center;
    gap: 4px;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.lead-actions button i {
    width: 14px;
    height: 14px;
}

.lead-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--gold);
}

.lead-actions button:active {
    transform: scale(0.95);
}

.lead-actions .btn-gold {
    background: var(--gold);
    color: #000;
    border-color: var(--gold);
    font-weight: 600;
}

.lead-actions .btn-gold:hover {
    background: var(--gold-light);
}

.lead-actions .btn-green {
    background: var(--green-bg);
    color: var(--green);
    border-color: rgba(34, 197, 94, 0.3);
}

.lead-actions .btn-red {
    background: var(--red-bg);
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.3);
}

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

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state i {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 16px;
}

/* ============================================
   FOLLOW-UP TABS
   ============================================ */

.followup-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.followup-tabs::-webkit-scrollbar {
    display: none;
}

.followup-tab {
    flex: 1;
    min-width: 80px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.followup-tab.active {
    background: var(--gold);
    color: #000;
    border-color: var(--gold);
    font-weight: 600;
}

.followup-tab:active {
    transform: scale(0.96);
}

/* ============================================
   FLOATING ACTION BUTTON
   ============================================ */

.fab {
    position: fixed;
    bottom: 88px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gold);
    color: #000;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
    z-index: 40;
    transition: var(--transition);
}

.fab i {
    width: 24px;
    height: 24px;
}

.fab:active {
    transform: scale(0.92);
}

.fab-menu {
    display: none;
    position: fixed;
    bottom: 156px;
    right: 20px;
    flex-direction: column;
    gap: 10px;
    z-index: 40;
    animation: slideUp 0.2s ease;
}

.fab-menu.active {
    display: flex;
}

.fab-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow);
    font-family: inherit;
    white-space: nowrap;
}

.fab-menu button i {
    color: var(--gold);
    width: 18px;
    height: 18px;
}

/* ============================================
   BOTTOM NAVIGATION
   ============================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(17, 17, 17, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 16px;
    z-index: 50;
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 4px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.bottom-nav .nav-item i {
    width: 22px;
    height: 22px;
}

.bottom-nav .nav-item.active {
    color: var(--gold);
}

.bottom-nav .nav-item .nav-badge {
    position: absolute;
    top: 0;
    right: 4px;
    font-size: 10px;
    padding: 1px 5px;
    min-width: 16px;
}

/* ============================================
   MODALS
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    border-top: 1px solid var(--border);
}

.modal-small {
    max-width: 480px;
    border-radius: var(--radius-lg);
    margin: auto 16px;
    max-height: 80vh;
}

.modal-prompt {
    max-width: 560px;
    border-radius: var(--radius-lg);
    margin: auto 16px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 0;
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header h3 i {
    color: var(--gold);
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 20px;
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: 16px;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--gold);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.modal-actions button {
    flex: 1;
    padding: 14px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.modal-actions button i {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--gold);
    color: #000;
    border: none;
}

.btn-primary:hover {
    background: var(--gold-light);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--text-primary);
}

.btn-icon i {
    width: 20px;
    height: 20px;
}

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

.prompt-box {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    max-height: 50vh;
    overflow-y: auto;
}

/* ============================================
   TOASTS
   ============================================ */

.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow);
    animation: slideDown 0.3s ease;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast i {
    color: var(--gold);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast.success {
    border-left-color: var(--green);
}

.toast.success i {
    color: var(--green);
}

.toast.error {
    border-left-color: var(--red);
}

.toast.error i {
    color: var(--red);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

@media (min-width: 768px) {
    .sidebar {
        display: flex;
    }

    .main-content {
        margin-left: 260px;
        padding-bottom: 0;
    }

    .bottom-nav {
        display: none;
    }

    .fab {
        bottom: 32px;
        right: 32px;
    }

    .fab-menu {
        bottom: 100px;
        right: 32px;
    }

    .menu-toggle {
        display: none;
    }

    .modal {
        max-width: 520px;
        border-radius: var(--radius-lg);
        margin: auto;
        max-height: 85vh;
    }

    .modal-overlay {
        align-items: center;
    }

    .home-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-number {
        font-size: 28px;
    }

    .quick-actions {
        grid-template-columns: repeat(3, 1fr);
        max-width: 600px;
    }

    .lead-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
        gap: 16px;
    }

    .view-container {
        padding: 24px;
        max-width: 1200px;
    }

    .app-header {
        padding: 16px 24px;
    }

    .search-bar,
    .filter-bar {
        padding-left: 24px;
        padding-right: 24px;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .lead-list {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* ============================================
   UTILITY
   ============================================ */

.hidden {
    display: none !important;
}
