/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #5b6abf;
    --primary-dark: #454fa0;
    --primary-light: #eef0fa;
    --accent: #7c8ae6;
    --bg: #f8f9fc;
    --card: #ffffff;
    --text: #2d2d2d;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --success: #10b981;
    --danger: #ef4444;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
}

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

main { flex: 1; }

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

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

/* === Navbar === */
.navbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}
.logo:hover { text-decoration: none; }

.nav-links { display: flex; align-items: center; gap: 16px; }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none !important;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }

.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-outline { background: transparent; color: var(--danger); border: 1px solid var(--danger); }

.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-lg { padding: 14px 32px; font-size: 1.1rem; }
.btn-block { width: 100%; }

/* === Hero === */
.hero {
    text-align: center;
    padding: 80px 0 60px;
    background: linear-gradient(135deg, var(--primary-light) 0%, #fff 100%);
}

.hero h1 { font-size: 2.5rem; line-height: 1.3; margin-bottom: 16px; }
.hero .accent { color: var(--primary); }
.hero-sub { font-size: 1.2rem; color: var(--text-muted); margin-bottom: 32px; max-width: 600px; margin-left: auto; margin-right: auto; }
.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* === Features === */
.features { padding: 60px 0; }
.features h2 { text-align: center; font-size: 2rem; margin-bottom: 40px; }

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

.feature-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature-icon { font-size: 2.5rem; margin-bottom: 12px; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.feature-card p { color: var(--text-muted); font-size: 0.95rem; }

/* === How It Works === */
.how-it-works { padding: 60px 0; background: var(--primary-light); }
.how-it-works h2 { text-align: center; font-size: 2rem; margin-bottom: 40px; }

.steps { display: flex; gap: 32px; justify-content: center; flex-wrap: wrap; }
.step { text-align: center; flex: 1; min-width: 200px; max-width: 300px; }
.step-num {
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--primary); color: #fff; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.2rem; margin-bottom: 12px;
}
.step h3 { font-size: 1.1rem; margin-bottom: 8px; }
.step p { color: var(--text-muted); }

/* === Auth === */
.auth-section { padding: 60px 0; display: flex; align-items: center; justify-content: center; min-height: 70vh; }

.auth-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    width: 100%;
}
.auth-card h2 { text-align: center; margin-bottom: 24px; }
.auth-footer { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 0.9rem; }

/* === Forms === */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(231, 84, 128, 0.15);
}

/* === Alerts === */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* === Dashboard === */
.dashboard { padding: 40px 0; }

.dashboard-header { margin-bottom: 24px; }
.dashboard-header h1 { font-size: 1.8rem; }
.back-link { font-size: 0.9rem; color: var(--text-muted); display: inline-block; margin-bottom: 8px; }

.section-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.section-header h2 { font-size: 1.3rem; }

/* === Bot Cards === */
.bots-grid { display: grid; gap: 16px; }

.bot-card {
    background: var(--bg);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.bot-info h3 { font-size: 1.1rem; margin-bottom: 4px; }
.bot-username { color: var(--text-muted); font-size: 0.85rem; }
.bot-status { font-size: 0.85rem; margin-top: 4px; }
.bot-status.active { color: var(--success); }
.bot-status.inactive { color: var(--danger); }
.bot-actions { display: flex; gap: 8px; flex-wrap: wrap; }

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

/* === Tabs === */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
}

.tab {
    padding: 10px 18px;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover { color: var(--text); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* === Table === */
.table-wrap { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.data-table td { font-size: 0.9rem; }

/* === Chips === */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.chip-remove { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--primary-dark); line-height: 1; }

/* === Inline Form === */
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem; }

/* === Stats === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }

.stat-card {
    background: var(--bg);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* === Badge === */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fef2f2; color: #dc2626; }

/* === Modal === */
.modal { display: none; position: fixed; inset: 0; z-index: 200; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.modal-content {
    background: var(--card);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 480px;
    width: 90%;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}
.modal-content h2 { margin-bottom: 12px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }

/* === Loading === */
.loading {
    text-align: center;
    padding: 12px;
    color: var(--primary);
    font-weight: 500;
}

/* === Footer === */
.footer {
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* === Responsive === */
@media (max-width: 640px) {
    .hero h1 { font-size: 1.6rem; }
    .hero-sub { font-size: 1rem; }
    .auth-card { padding: 24px; }
    .section-header { flex-direction: column; align-items: flex-start; }
    .bot-card { flex-direction: column; align-items: flex-start; }
    .form-row { flex-direction: column; }
    .header-actions { margin-top: 12px; }
}

/* === Bot manage extras === */
.header-actions { display: flex; gap: 12px; align-items: center; }

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.edit-input {
    padding: 6px 10px;
    border: 2px solid var(--primary);
    border-radius: 6px;
    font-size: 0.95rem;
    width: 200px;
}

.row-inactive { opacity: 0.5; }

.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fef2f2; color: #dc2626; }

.td-desc { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }

.settings-form { max-width: 600px; }

.save-ok {
    color: var(--success);
    font-weight: 600;
    margin-left: 12px;
}

.back-link {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.back-link:hover { color: var(--primary); text-decoration: none; }

/* Product thumbnails */
.thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.no-thumb {
    display: inline-flex;
    width: 50px;
    height: 50px;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: 8px;
    font-size: 1.4rem;
}
