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

:root {
    --primary: #25D366;
    --primary-dark: #128C7E;
    --primary-light: #DCF8C6;
    --bg: #0a0f1a;
    --bg-card: #111827;
    --bg-sidebar: #0d1321;
    --bg-input: #1a2236;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --border: #1f2937;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #22c55e;
    --info: #3b82f6;
    --radius: 12px;
}

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

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

/* SIDEBAR */
.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.5rem;
    margin-bottom: 2rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.logo i {
    font-size: 1.75rem;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: var(--text);
    background: rgba(255,255,255,0.04);
}

.nav-item.active {
    color: var(--primary);
    background: rgba(37,211,102,0.08);
    border-left-color: var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

/* CONTENT */
.content {
    flex: 1;
    margin-left: 240px;
    padding: 2rem;
    max-width: 1000px;
}

.tab-content {
    display: none;
}

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

.tab-header {
    margin-bottom: 1.5rem;
}

.tab-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.tab-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.tab-header code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--primary);
}

/* CARDS */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.card-body.center {
    text-align: center;
}

/* FORMS */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

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

textarea {
    resize: vertical;
    min-height: 120px;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.flex-1 {
    flex: 1;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.btn:active {
    transform: translateY(0);
}

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

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

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

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

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.9rem 2rem;
    font-size: 1rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

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

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

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

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

/* DEVICES GRID */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.device-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.device-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.device-card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.device-phone {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.device-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.status-dot.connecting {
    background: var(--warning);
    animation: pulse 1.5s infinite;
}

.status-dot.qr_ready {
    background: var(--info);
    animation: pulse 1.5s infinite;
}

.status-dot.disconnected {
    background: var(--danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.device-proxy-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.device-proxy-indicator i {
    color: var(--info);
    font-size: 0.9rem;
}

.device-proxy-indicator span {
    color: var(--info);
    font-weight: 600;
}

.device-proxy-indicator small {
    display: block;
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-top: 0.15rem;
    word-break: break-all;
}

/* UPLOAD AREA */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(37,211,102,0.03);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(37,211,102,0.08);
}

.upload-area i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.upload-area p {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

/* TABLE */
.table-container {
    overflow-x: auto;
    margin-top: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th, td {
    padding: 0.65rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

th {
    background: var(--bg-input);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255,255,255,0.02);
}

/* INFO BOX */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: rgba(59,130,246,0.08);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.info-box i {
    color: var(--info);
    margin-top: 2px;
}

.info-box .var-btn {
    display: inline-block;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    margin: 4px 4px 0 0;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--primary);
    transition: all 0.2s;
}

.info-box .var-btn:hover {
    background: var(--primary);
    color: #000;
}

/* PREVIEW */
.preview-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    min-height: 80px;
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* MEDIA LIST */
.media-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.media-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.media-item i {
    color: var(--primary);
}

.media-item .remove-media {
    color: var(--danger);
    cursor: pointer;
    margin-left: 0.25rem;
}

.media-item .remove-media:hover {
    color: #ff6b6b;
}

/* SUMMARY CARDS */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.summary-card i {
    font-size: 1.75rem;
    color: var(--primary);
    opacity: 0.8;
}

.summary-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.summary-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* CHECKLIST */
.checklist {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.check-item i.fa-check-circle {
    color: var(--success);
}

.check-item i.fa-times-circle {
    color: var(--danger);
}

/* PROGRESS */
.progress-info {
    margin-bottom: 1.5rem;
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background: var(--bg-input);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-dark), var(--primary));
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s ease;
}

.progress-stats {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
}

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.error-msg {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--danger);
}

/* DONE BOX */
.done-box {
    text-align: center;
    padding: 2rem;
}

.done-box i {
    font-size: 3rem;
    color: var(--success);
    margin-bottom: 1rem;
}

.done-box h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.done-box p {
    color: var(--text-muted);
}

/* HELP TEXT */
.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* EMPTY STATE */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-size: 0.9rem;
}

/* QR CODE */
#qr-container {
    display: inline-block;
    padding: 1rem;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 1rem;
}

#qr-container img {
    display: block;
}

.qr-placeholder {
    width: 256px;
    height: 256px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
}

.qr-placeholder i {
    font-size: 2rem;
    color: #999;
    margin-bottom: 0.5rem;
}

/* PHONE COLUMNS CARD */
.phone-columns-card {
    background: var(--bg-input);
    border: 1px solid rgba(37,211,102,0.2);
    margin-bottom: 0;
}

.phone-columns-card .card-header {
    border-bottom-color: rgba(37,211,102,0.15);
}

.phone-columns-card .card-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.phone-columns-card .card-header h2 i {
    color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .sidebar .logo span,
    .sidebar .nav-item span {
        display: none;
    }
    .content {
        margin-left: 60px;
    }
    .summary-cards {
        grid-template-columns: 1fr;
    }
    .form-row {
        flex-direction: column;
    }
}
