:root {
    /* Theme: Light (Default) - Clean Apple-like aesthetic */
    --primary: #10b981;
    --primary-hover: #059669;
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --glass-border: rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 16px;
}

[data-theme="dark"] {
    /* Theme: Dark - Deep Dashboard aesthetic */
    --bg-app: #020617;
    --bg-card: #0f172a;
    --bg-sidebar: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #1e293b;
    --glass-border: rgba(255, 255, 255, 0.05);
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

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

/* Scrollbar Styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Layout Structure */
.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 300px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.brand h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.brand span {
    color: var(--primary);
}

/* Theme Toggle */
.theme-switch-wrapper {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 1rem;
    background: var(--bg-app);
    border-radius: 12px;
    justify-content: center;
    cursor: pointer;
}

/* Connection Box */
.connection-box {
    background: var(--bg-app);
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--border);
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    margin-bottom: 1.5rem;
}

.disconnected { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.connected { background: rgba(16, 185, 129, 0.1); color: #10b981; }

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

#qr-image {
    width: 200px;
    height: 200px;
    border-radius: 12px;
    margin: 1rem auto;
    border: 8px solid white;
    background: white;
    display: block;
}

.qr-placeholder {
    width: 200px;
    height: 200px;
    background: rgba(0,0,0,0.05);
    border-radius: 12px;
    margin: 1rem auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border);
}

/* Main Content area */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

/* Form Styles */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

label {
    font-size: 0.813rem;
    font-weight: 600;
    color: var(--text-muted);
}

input, select, textarea {
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-size: 0.875rem;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Editor Toolbar */
.editor-toolbar {
    display: flex;
    gap: 5px;
    padding: 8px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    flex-wrap: wrap;
}

.tool-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 6px;
}

.tool-btn:hover {
    background: var(--bg-app);
    color: var(--primary);
}

.pro-textarea {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    resize: vertical;
    min-height: 120px;
}

/* Dashboard Splitting */
.dashboard-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.preview-card {
    background: #e5ddd5 url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    border-radius: var(--radius);
    overflow: hidden;
    height: 400px;
    display: flex;
    flex-direction: column;
}

.preview-header {
    background: #075e54;
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.preview-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.wa-bubble {
    background: #dcf8c6;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border-top-right-radius: 0;
    float: right;
    max-width: 85%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    font-size: 0.875rem;
    color: #111;
}

/* Task Board */
.tasks-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    list-style: none;
}

.task-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.btn-primary {
    background: var(--primary);
    color: white;
    font-weight: 700;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s, background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

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

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

/* Mobile Responsive */
.task-item {
    transition: all 0.2s ease;
}

.task-item.selected {
    border-left-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.05) !important;
}

.drag-handle:hover {
    color: var(--primary) !important;
}

.task-checkbox-wrapper {
    animation: taskIn 0.3s ease;
}

@keyframes taskIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body { flex-direction: column; overflow: auto; }
    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        bottom: 0;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 20px 0 50px rgba(0,0,0,0.2);
    }
    .sidebar.open { left: 0; }
    .app-container { flex-direction: column; height: auto; }
    .main-content { padding: 1.25rem; height: auto; overflow: visible; }
    .mobile-header { display: flex; }
    .form-grid { grid-template-columns: 1fr; }
    .tasks-container { grid-template-columns: 1fr; }
    .preview-card { height: 300px; }
}

/* Dropdown Search */
.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
    display: none;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    font-size: 0.875rem;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-sidebar);
    padding: 2rem;
    border-radius: var(--radius);
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow);
}
