:root {
    --bg-color: #121212;
    --card-bg: #1E1E1E;
    --primary: #25D366; /* WhatsApp Green */
    --primary-dark: #128C7E;
    --text-main: #FFFFFF;
    --text-muted: #A0A0A0;
    --border: #333333;
    --danger: #FF3B30;
    
    /* Bubble colors */
    --wa-bg: #0B141A; /* Dark mode WA bg */
    --wa-bubble-bg: #005C4B; /* Dark mode WA outgoing bubble */
    --wa-text: #E9EDEF;
    --wa-muted: #8696A0;
    --wa-link: #53BDEB;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s ease, transform 0.3s ease;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom);
}

.view.hidden {
    opacity: 0;
    pointer-events: none;
    display: none; /* Add display none to completely hide when inactive to save scroll */
}

.view.active {
    opacity: 1;
    pointer-events: all;
    transform: translateX(0);
    display: flex;
}

.hidden {
    display: none !important;
}

/* Header */
header {
    padding: 2rem 1.5rem;
    background: linear-gradient(180deg, rgba(37,211,102,0.1) 0%, rgba(18,18,18,0) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--primary);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #FFF;
}

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

.header-compact {
    flex-direction: row;
    justify-content: space-between;
    padding: 1rem 1.5rem;
}

.logo-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
}

.logo-compact h2 {
    font-size: 1.2rem;
    color: #FFF;
}

/* Layout */
.config-container, .capture-container {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.text-muted {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* Inputs */
.input-group {
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

input, select {
    width: 100%;
    background: #0A0A0A;
    border: 1px solid var(--border);
    color: #FFF;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

select {
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23FFFFFF" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
    background-repeat: no-repeat;
    background-position-x: 95%;
    background-position-y: 50%;
}

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

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #FFF;
    color: #000;
    padding: 16px;
    font-size: 1rem;
}

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

.btn-large {
    width: 100%;
    padding: 16px;
}

.btn-icon {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #FFF;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-outline {
    background: transparent;
    color: #FFF;
    border: 1px solid rgba(255,255,255,0.3);
}

.action-buttons {
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Capture View Specifics */
.capture-container {
    justify-content: center;
    align-items: center;
}

.status-indicator {
    background: rgba(37,211,102,0.1);
    border: 1px solid rgba(37,211,102,0.2);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-bars {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 2rem;
    gap: 10px;
}

.count-indicator {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #FFF;
}

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

.dot.green { background: var(--primary); box-shadow: 0 0 8px var(--primary); }
.dot.red { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.dot.yellow { background: #FFCC00; box-shadow: 0 0 8px #FFCC00; }

.phone-input-wrapper {
    display: flex;
    align-items: stretch;
    width: 100%;
    margin-bottom: 0.5rem;
}

.prefix {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-right: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    font-weight: 800;
    padding: 20px 16px;
    border-radius: 16px 0 0 16px;
    display: flex;
    align-items: center;
}

#client-phone {
    flex: 1;
    font-size: 2rem;
    font-weight: 800;
    padding: 20px;
    border-radius: 0 16px 16px 0;
    letter-spacing: 2px;
    text-align: center;
}

.hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 2rem;
}

.btn-massive {
    width: 100%;
    padding: 24px;
    font-size: 1.3rem;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(37,211,102,0.3);
}

.logs-container {
    margin-top: 2rem;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-entry {
    background: var(--card-bg);
    border-left: 4px solid var(--border);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.log-entry.success { border-color: var(--primary); }
.log-entry.error { border-color: var(--danger); }

.log-phone { font-weight: 600; font-family: monospace; }
.log-time { color: var(--text-muted); font-size: 0.75rem; }

/* WhatsApp Preview Bubble */
.wa-preview-container {
    background: var(--wa-bg);
    padding: 20px 15px;
    border-radius: 12px;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: flex-end;
}

.wa-bubble {
    background: var(--wa-bubble-bg);
    border-radius: 8px 0 8px 8px;
    padding: 6px 8px;
    max-width: 90%;
    box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
    position: relative;
    color: var(--wa-text);
}

.wa-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-top: 0 solid transparent;
    border-bottom: 13px solid transparent;
    border-left: 13px solid var(--wa-bubble-bg);
}

#preview-header {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 0.95rem;
    padding: 2px 4px;
}

#preview-body {
    font-size: 0.95rem;
    line-height: 1.35;
    white-space: pre-wrap;
    padding: 2px 4px;
    margin-bottom: 16px; /* Space for time */
}

.wa-footer {
    font-size: 0.75rem;
    color: var(--wa-muted);
    padding: 2px 4px;
    margin-top: 4px;
}

.wa-buttons {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    overflow: hidden;
}

.wa-button {
    background: var(--wa-bubble-bg);
    color: var(--wa-link);
    text-align: center;
    padding: 10px;
    font-size: 0.95rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-weight: 500;
}

.wa-time {
    position: absolute;
    bottom: 4px;
    right: 8px;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.6);
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
