/* TaskVox AI - Admin Dashboard Styles */

:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-sidebar: #141620;
    --border: #2a2d3a;
    --text: #e4e4e7;
    --text-muted: #9ca3af;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.sidebar-brand {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand h2 {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-nav {
    list-style: none;
    padding: 12px 0;
    flex: 1;
}

.sidebar-nav li a {
    display: block;
    padding: 10px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: all .2s;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    color: var(--text);
    background: rgba(99, 102, 241, 0.1);
    border-left-color: var(--primary);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
}

.sidebar-footer a {
    color: var(--danger);
    text-decoration: none;
}

/* Content */
.content {
    flex: 1;
    margin-left: 240px;
    padding: 0;
    min-height: 100vh;
}

.content-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
}

.content-header h1 {
    font-size: 22px;
    font-weight: 600;
}

/* Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px 30px;
}

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

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
}

.stat-card .stat-value.primary {
    color: var(--primary);
}

.stat-card .stat-value.success {
    color: var(--success);
}

.stat-card .stat-value.warning {
    color: var(--warning);
}

.stat-card .stat-value.danger {
    color: var(--danger);
}

/* Tables */
.table-container {
    padding: 20px 30px 80px;
    overflow: visible;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

th,
td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

th {
    background: rgba(99, 102, 241, 0.05);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

tr:hover {
    background: rgba(99, 102, 241, 0.03);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-running {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.badge-paused {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.badge-completed {
    background: rgba(156, 163, 175, 0.15);
    color: var(--text-muted);
}

.badge-answered {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.badge-no_answer {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.badge-failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.badge-dialing {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all .2s;
}

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

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

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    color: #000;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* Forms */
.form-container {
    padding: 20px 30px;
    max-width: 700px;
}

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

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

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

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

.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(99, 102, 241, 0.15);
}

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

/* Alerts */
.alert {
    padding: 12px 20px;
    border-radius: var(--radius);
    margin: 16px 30px;
    font-size: 14px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success);
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    width: 380px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 24px;
}

.login-box .btn {
    width: 100%;
    text-align: center;
    margin-top: 8px;
}

/* Action bar */
.action-bar {
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Modal overlay */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px;
    width: 550px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h2 {
    margin-bottom: 20px;
}

/* Progress Bars */
.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-fill.warning-fill {
    background: var(--warning);
}

.progress-fill.danger-fill {
    background: var(--danger);
}

/* Stat descriptions */
.stat-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-value.info {
    color: var(--info);
}

/* Feature badges */
.feature-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.feature-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.feature-badge.enabled {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.feature-badge.disabled {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    text-decoration: line-through;
}

/* Plan cards grid */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.plan-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all .2s;
}

.plan-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.plan-card.plan-current {
    border-color: var(--success);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.1);
}

.plan-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.plan-price {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 16px;
}

.plan-period {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
}

.plan-features {
    list-style: none;
    text-align: left;
    font-size: 13px;
    color: var(--text-muted);
}

.plan-features li {
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Checkbox group */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
}

.checkbox-label:has(input:checked) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.checkbox-label input {
    accent-color: var(--primary);
}

/* URL display */
.url-display {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 3px 8px;
    border-radius: 4px;
    word-break: break-all;
}

/* Transcript chat bubbles */
.transcript-container {
    max-height: 600px;
    overflow-y: auto;
    padding: 8px 0;
}

.transcript-msg {
    margin-bottom: 12px;
    max-width: 80%;
}

.transcript-msg.transcript-agent {
    margin-right: auto;
}

.transcript-msg.transcript-user {
    margin-left: auto;
}

.transcript-role {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
}

.transcript-msg.transcript-user .transcript-role {
    text-align: right;
}

.transcript-text {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.transcript-agent .transcript-text {
    background: rgba(99, 102, 241, 0.12);
    border-bottom-left-radius: 4px;
}

.transcript-user .transcript-text {
    background: rgba(34, 197, 94, 0.12);
    border-bottom-right-radius: 4px;
    text-align: right;
}

/* Recording player */
.recording-player {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.recording-player audio {
    width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .sidebar-brand h2,
    .sidebar-nav li a span,
    .sidebar-footer span {
        display: none;
    }

    .content {
        margin-left: 60px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }
}

/* Action Dropdown */
.action-dropdown .dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 160px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.action-dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: rgba(99, 102, 241, 0.15);
}