/* PultChat — Styles */

:root {
    --bg-primary: #0f1923;
    --bg-secondary: #1a2836;
    --bg-card: #1e3042;
    --bg-hover: #243b50;
    --text-primary: #e8edf2;
    --text-secondary: #8899a6;
    --text-muted: #5c6e7e;
    --accent: #1da1f2;
    --accent-hover: #1a91da;
    --success: #17bf63;
    --warning: #ffad1f;
    --danger: #e0245e;
    --border: #2e4052;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --sidebar-width: 240px;
}

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

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ===== BUTTONS ===== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c4204f; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

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

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

input[type="text"], input[type="email"], input[type="password"], input[type="tel"], select, textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

small { display: block; margin-top: 4px; }

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== LANDING ===== */

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

.logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
}
.logo span { color: var(--accent); }

.hero {
    text-align: center;
    padding: 80px 0 60px;
}

.hero h1 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero h1 span { color: var(--accent); }

.hero p {
    font-size: 20px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    padding: 60px 0;
}

.feature-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 32px;
    border: 1px solid var(--border);
    transition: transform 0.2s, border-color 0.2s;
}
.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.feature-icon { font-size: 40px; margin-bottom: 16px; }
.feature-card h3 { margin-bottom: 8px; font-size: 18px; }
.feature-card p { color: var(--text-secondary); font-size: 14px; }

.messengers {
    display: flex;
    gap: 32px;
    justify-content: center;
    padding: 40px 0;
}

.messenger-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
}
.messenger-badge .icon { font-size: 28px; }

.pricing { text-align: center; padding: 60px 0; }
.pricing h2 { font-size: 32px; margin-bottom: 40px; }

.price-card {
    display: inline-block;
    background: var(--bg-secondary);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 400px;
}

.price-amount { font-size: 48px; font-weight: 800; color: var(--accent); }
.price-period { color: var(--text-secondary); font-size: 16px; }
.price-desc { color: var(--text-secondary); margin: 16px 0 24px; }

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

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 460px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    max-height: 90vh;
    overflow-y: auto;
}

.modal h2 { margin-bottom: 24px; font-size: 22px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-header h2 { margin-bottom: 0; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }

.modal-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.modal-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.modal-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.error-msg {
    background: rgba(224, 36, 94, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
}

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

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-logo {
    font-size: 22px;
    font-weight: 800;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo span { color: var(--accent); }

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-section {
    padding: 16px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
    font-size: 14px;
    font-weight: 500;
}
.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.nav-item.active {
    background: rgba(29, 161, 242, 0.1);
    color: var(--accent);
    border-right: 3px solid var(--accent);
}

.nav-icon { font-size: 18px; width: 24px; text-align: center; }

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

.user-info-compact {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.user-details { overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100vh;
}

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
}

.filter-bar {
    display: flex;
    gap: 8px;
}

.filter-bar select {
    width: auto;
    padding: 8px 12px;
    font-size: 13px;
}

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

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

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.stat-value { font-size: 32px; font-weight: 800; }
.stat-label { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }

/* ===== SECTION ===== */

.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}

/* ===== CHANNELS ===== */

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.channel-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color 0.2s;
}
.channel-card.clickable { cursor: pointer; }
.channel-card.clickable:hover { border-color: var(--accent); }

.channel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.channel-icon { font-size: 28px; }
.channel-name { font-size: 15px; font-weight: 700; }

.channel-status {
    margin-left: auto;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status-active { background: rgba(23,191,99,0.15); color: var(--success); }
.status-inactive { background: rgba(92,110,126,0.15); color: var(--text-muted); }
.status-pending { background: rgba(255,173,31,0.15); color: var(--warning); }

.channel-desc {
    color: var(--text-secondary);
    font-size: 13px;
}

/* ===== CRM CARDS ===== */

.crm-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.crm-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.crm-logo { font-size: 36px; }
.crm-info h3 { font-size: 16px; }
.crm-info p { font-size: 13px; color: var(--text-secondary); }

.crm-card-large {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.crm-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
}
.crm-logo-lg { font-size: 42px; }
.crm-card-header h2 { font-size: 18px; }
.crm-card-header p { font-size: 13px; color: var(--text-secondary); }

/* ===== SESSION CARDS ===== */

.session-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.session-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 200px;
}

.session-icon { font-size: 28px; }
.session-name { font-size: 15px; font-weight: 600; }
.session-phone { font-size: 13px; color: var(--text-secondary); }

.session-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.session-msgs { font-size: 12px; color: var(--text-muted); }

.session-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state h3 { font-size: 20px; color: var(--text-primary); margin-bottom: 8px; }
.empty-state p { margin-bottom: 24px; max-width: 400px; margin-left: auto; margin-right: auto; }

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

.messages-table {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-header {
    display: grid;
    grid-template-columns: 100px 100px 80px 150px 1fr 60px;
    gap: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.th {
    padding: 10px 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 700;
}

.table-row {
    display: grid;
    grid-template-columns: 100px 100px 80px 150px 1fr 60px;
    gap: 0;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.table-row:last-child { border-bottom: none; }
.table-row:hover { background: var(--bg-hover); }

.td {
    padding: 10px 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.msg-text {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messenger-badge-sm {
    font-size: 12px;
    background: var(--bg-primary);
    padding: 2px 8px;
    border-radius: 12px;
}

.direction-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
}
.direction-badge.incoming { background: rgba(23,191,99,0.1); color: var(--success); }
.direction-badge.outgoing { background: rgba(29,161,242,0.1); color: var(--accent); }

.pagination {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* ===== CHAT CARDS ===== */

.chat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}
.chat-card:hover { background: var(--bg-hover); }
.chat-card:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.chat-card:last-child { border-radius: 0 0 var(--radius) var(--radius); border-bottom: none; }

.chat-avatar { font-size: 28px; }
.chat-info { flex: 1; overflow: hidden; }
.chat-name { font-size: 14px; font-weight: 600; }
.chat-last-msg { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-meta { text-align: right; flex-shrink: 0; }
.chat-time { font-size: 12px; color: var(--text-muted); }
.chat-count { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== QR CODE ===== */

.qr-container { text-align: center; }
.qr-image { max-width: 260px; border-radius: 12px; }

/* ===== NOTIFICATIONS ===== */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2000;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.notification button {
    background: none;
    border: none;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    padding: 0;
    line-height: 1;
}

.notification-success { background: var(--success); color: #fff; }
.notification-error { background: var(--danger); color: #fff; }
.notification-info { background: var(--accent); color: #fff; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== LOADING ===== */

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

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

@media (max-width: 768px) {
    .hero h1 { font-size: 32px; }
    .hero p { font-size: 16px; }
    .hero-buttons { flex-direction: column; align-items: center; }
    .messengers { flex-wrap: wrap; justify-content: center; gap: 12px; }
    .features { grid-template-columns: 1fr; }

    .sidebar {
        width: 60px;
        overflow: hidden;
    }
    .sidebar-logo { font-size: 0; padding: 16px; }
    .sidebar-logo::after { content: 'P'; font-size: 22px; font-weight: 800; color: var(--accent); }
    .nav-section { display: none; }
    .nav-item { padding: 12px 18px; font-size: 0; }
    .nav-icon { font-size: 22px; }
    .sidebar-footer { display: none; }

    .main-content {
        margin-left: 60px;
        padding: 16px;
    }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .channels-grid { grid-template-columns: 1fr; }
    .crm-cards { grid-template-columns: 1fr; }

    .table-header, .table-row {
        grid-template-columns: 70px 80px 60px 100px 1fr 40px;
    }
    .th, .td { padding: 8px 6px; font-size: 11px; }

    .session-card { flex-direction: column; align-items: flex-start; }
    .session-stats { margin-left: 0; }
    .session-actions { width: 100%; }

    .page-header { flex-direction: column; align-items: flex-start; }
    .filter-bar { width: 100%; }
    .filter-bar select { flex: 1; }
}
