/* Base Reset and Variables */
:root {
    /* Colors based on Firecrawl inspiration */
    --bg-main: #FAFAFA;
    --bg-sidebar: #FFFFFF;
    --bg-card: #FFFFFF;
    
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    
    --brand-orange: #F97316;
    --brand-orange-hover: #EA580C;
    --brand-orange-light: #FFEDD5;
    
    --border-color: #F3F4F6;
    --border-hover: #E5E7EB;
    
    --whatsapp-green: #25D366;
    --whatsapp-green-hover: #128C7E;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    position: relative; /* needed for ::before positioning */
}

/* Full-viewport grid background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background-image:
        linear-gradient(to right, var(--grid-color, rgba(0,0,0,0.045)) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-color, rgba(0,0,0,0.045)) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
    /* Fade from visible at top to invisible after 55% scroll */
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 40%, rgba(0,0,0,0) 65%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 40%, rgba(0,0,0,0) 65%);
}

/* Full-width orange glow anchored to the very top of the viewport */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 70vh;
    background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(249, 115, 22, 0.10) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

:root.dark body::after {
    background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(249, 115, 22, 0.18) 0%, transparent 70%);
}

:root.dark body::before {
    --grid-color: rgba(255, 255, 255, 0.04);
}

/* Ensure all direct stacking-context children sit above the grid */
.app-container,
.login-body {
    position: relative;
    z-index: 1;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ================================================================
   DARK MODE TOKENS
   ================================================================ */
:root.dark {
    --bg-main: #0F1117;
    --bg-sidebar: #15181f;
    --bg-card: #1a1d27;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --border-color: #1E2330;
    --border-hover: #2A3040;
    --brand-orange-light: rgba(249, 115, 22, 0.15);
    /* Cores para o preview no dark mode */
    --wa-bg-preview: #202c33;
    --wa-text-preview: #e9edef;
    --wa-bg-image-pane: #111b21;
    --status-success-bg: rgba(16, 185, 129, 0.15);
    --status-success-text: #10B981;
}

/* ================================================================
   SIDEBAR – Controlled Collapsible
   ================================================================ */

.sidebar {
    width: 240px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s ease;
    position: relative;
    z-index: 100;
}

.sidebar.collapsed {
    width: 72px;
}

.sidebar.collapsed .logo h2 {
    display: none;
}

/* Toggle Button */
.sidebar-toggle-btn {
    position: absolute;
    right: -12px;
    top: 24px;
    width: 24px;
    height: 24px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 101;
    color: var(--text-secondary);
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle-btn:hover {
    color: var(--brand-orange);
    border-color: var(--brand-orange);
    transform: scale(1.1);
}

.sidebar.collapsed .sidebar-toggle-btn {
    right: 50%;
    transform: translateX(50%) rotate(180deg);
    top: 70px;
}

.sidebar.collapsed .sidebar-toggle-btn:hover {
    transform: translateX(50%) rotate(180deg) scale(1.1);
}

/* Ensure icons don't shrink and stay centered */
.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px;
    gap: 0;
}

.sidebar.collapsed .logo {
    justify-content: center;
    padding-left: 0;
}

/* ================================================================
   SIDEBAR – Labels & Transitions
   ================================================================ */

.sidebar .sidebar-label {
    opacity: 1;
    max-width: 200px;
    margin-left: 0;
    overflow: hidden;
    white-space: nowrap;
    display: inline-block;
    transition: opacity 0.2s ease, max-width 0.3s ease;
    vertical-align: middle;
}

.sidebar.collapsed .sidebar-label {
    opacity: 0;
    max-width: 0;
    pointer-events: none;
}

/* ================================================================
   SIDEBAR – Header & Logo
   ================================================================ */
.sidebar-header {
    padding: 24px 20px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--brand-orange);
    transition: all 0.3s;
}

.logo-icon {
    width: 28px;
    height: 28px;
}

.logo h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* ================================================================
   SIDEBAR – Nav & Sections
   ================================================================ */
.sidebar-nav {
    flex: 1;
    padding: 10px 14px;
    overflow-y: auto;
    scrollbar-width: none;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
    padding-left: 12px;
    display: flex;
    align-items: center;
    height: 20px;
    transition: all 0.3s;
}

.sidebar.collapsed .nav-section {
    margin-bottom: 16px;
}

.sidebar.collapsed .nav-label {
    display: none;
}

/* ================================================================
   SIDEBAR – Nav Items
   ================================================================ */
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    margin-bottom: 2px;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    appearance: none;
}

.nav-item:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--brand-orange-light);
    color: var(--brand-orange);
}

.nav-item i {
    width: 20px;
    height: 20px;
}

/* Theme Item Mini Switch */
.theme-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.theme-switch-mini {
    width: 34px;
    height: 18px;
    background: var(--border-hover);
    border-radius: 20px;
    position: relative;
    transition: background 0.3s;
}

:root.dark .theme-switch-mini {
    background: var(--brand-orange);
}

.switch-thumb {
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: left 0.2s;
}

:root.dark .switch-thumb {
    left: 18px;
}

/* ================================================================
   SIDEBAR – Footer & Profile
   ================================================================ */
.sidebar-footer {
    padding: 16px 14px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 12px;
    transition: background 0.2s;
    cursor: pointer;
}

.user-profile:hover {
    background: var(--border-color);
}

.avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--brand-orange-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-orange);
    overflow: hidden;
    border: 1px solid var(--border-hover);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    line-height: 1.2;
}

.user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.logout-item {
    color: var(--text-secondary);
}

.logout-item:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

:root.dark .logout-item:hover {
    background-color: var(--border-color);
}

/* Tooltip support for collapsed state */
.sidebar.collapsed .nav-item[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    margin-left: 10px;
    background: var(--text-primary);
    color: var(--bg-sidebar);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

/* ================================================================
   SMOOTH DARK/LIGHT MODE TRANSITION
   ================================================================ */
html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

*, *::before, *::after {
    transition-property: background-color, border-color, color;
    transition-duration: 0.25s;
    transition-timing-function: ease;
}


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

/* Top Header */
.top-header {
    height: 64px;
    padding: 0 32px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.workspace-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-main);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.workspace-icon {
    width: 20px;
    height: 20px;
    background-color: var(--brand-orange);
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--brand-orange);
    color: white;
}

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

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-main);
    border-color: var(--border-hover);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-hover);
}

.btn-outline:hover {
    background-color: var(--bg-main);
    color: var(--text-primary);
}

.btn-icon {
    padding: 8px;
    background: transparent;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.btn-whatsapp {
    background-color: var(--whatsapp-green);
    color: white;
    width: 100%;
    padding: 12px;
}

.btn-whatsapp:hover {
    background-color: var(--whatsapp-green-hover);
}

.w-full {
    width: 100%;
}

/* Premium Hero Section */
.hero-section {
    position: relative;
    padding: 60px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
    background: transparent; /* Glow is now handled globally by body::after */
    overflow: visible;
    text-align: center;
    margin: 0 auto;
}

/* Dark mode hero (no override needed — body::after handles the glow) */
:root.dark .hero-section {
    background: transparent;
}

/* Linear SVG Background Pattern - Subtle Grid (kept on hero for the glow fade) */
.hero-grid-bg {
    display: none; /* Grid is now rendered globally via body::before */
}

.hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 800px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.pill-badge i {
    width: 14px;
    height: 14px;
}

.hero-title {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.hero-title strong {
    color: var(--brand-orange);
}

.hero-title br {
    display: none; /* Only show on smaller screens if needed */
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin-bottom: 48px;
    line-height: 1.6;
}

.hero-input-wrapper {
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.hero-mode-selector {
    display: flex;
    background: var(--bg-main);
    padding: 4px;
    border-radius: 99px;
    border: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 99px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.mode-option i {
    width: 16px;
    height: 16px;
}

.mode-option:hover {
    color: var(--text-primary);
}

.mode-option.active {
    background: var(--brand-orange);
    color: white;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}

.mode-option.active.direct-active {
    background: #25D366;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2);
}

/* Green theme for the hero button */
.btn-whatsapp-theme {
    background-color: #25D366 !important;
}

.btn-whatsapp-theme:hover {
    background-color: #1eb954 !important;
}

.hero-search-box {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: 24px;
    padding: 8px 8px 8px 24px;
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border-color);
    transition: box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

:root.dark .hero-search-box {
    background: #2d3343; /* Lighter than #252936 for better contrast */
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.5), 0 0 0 1px #3a4155;
}

.hero-search-box:focus-within {
    box-shadow: 0 16px 32px -8px rgba(249, 115, 22, 0.15), 0 0 0 1px var(--brand-orange-light);
}

.hero-search-box .search-icon {
    color: var(--text-muted);
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.hero-search-box input {
    flex: 1;
    border: none;
    font-size: 1.125rem;
    padding: 16px;
    background: transparent;
    color: var(--text-primary);
    outline: none;
}

.hero-search-box input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.btn-hero {
    border-radius: 16px;
    width: 54px;
    height: 54px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.2s, background-color 0.2s;
}

.btn-hero:hover {
    transform: scale(1.05);
}

.btn-hero i {
    width: 20px;
    height: 20px;
}

/* Page Layout adjustments for Workspace */
.workspace-hidden {
    display: none !important;
}

.form-header-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.store-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-main);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

.content-body {
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.page-title {
    margin-bottom: 32px;
    text-align: center;
}

.page-title h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.page-title p {
    color: var(--text-secondary);
}

/* Workspace & Result Layout */
.generator-container {
    padding-top: 24px;
}

/* New Horizontal Result Card */
.result-card {
    display: flex;
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.05), 0 8px 10px -6px rgb(0 0 0 / 0.05);
    overflow: hidden;
    margin-bottom: 24px;
}

.result-image-pane {
    width: 40%;
    background-color: var(--bg-main);
    border-right: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    position: relative;
}

:root.dark .result-image-pane {
    background-color: var(--wa-bg-image-pane);
}

.result-image-pane img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    mix-blend-mode: multiply; /* Helps drop white backgrounds on product images */
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.1));
}

:root.dark .result-image-pane img {
    /* No dark mode we change the blend mode because multiply on dark background can darken the product too much */
    mix-blend-mode: normal;
    filter: drop-shadow(0 0 20px rgba(255,255,255,0.05));
}

.result-text-pane {
    width: 60%;
    padding: 32px;
    display: flex;
    flex-direction: column;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.status-badge.live {
    display: inline-flex;
    align-items: center;
    background-color: #ECFDF5;
    color: #059669;
}

:root.dark .status-badge.live {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
}

.wa-text-box {
    background: #F9FAFB;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 24px;
    flex-grow: 1;
    transition: all 0.3s ease;
}

:root.dark .wa-text-box {
    background: var(--wa-bg-preview);
    color: var(--wa-text-preview);
    border-color: rgba(255,255,255,0.05);
}

.wa-text-box pre {
    white-space: pre-wrap;
    font-family: inherit;
    margin: 0;
    line-height: 1.6;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mb-4 {
    margin-bottom: 16px;
}
.mt-4 {
    margin-top: 16px;
}
.mr-1 {
    margin-right: 4px;
}

/* Cards & Forms (kept for manual edit container) */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.form-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-subtitle {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-group input {
    padding: 10px 12px;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 2px var(--brand-orange-light);
}

.row {
    display: flex;
    gap: 16px;
}

.col-half {
    flex: 1;
}

/* Animations */
.spin {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    100% { transform: rotate(360deg); }
}

.fadeIn {

    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-loading {
    color: transparent !important;
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.empty-content i {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.preview-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.status-badge {
    background-color: var(--brand-orange-light);
    color: var(--brand-orange);
    padding: 4px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.whatsapp-mockup {
    background-color: #EFEAE2; /* classic WA background */
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

:root.dark .whatsapp-mockup {
    background-color: #0b141a; /* WhatsApp Dark mode background */
    border-color: #222d34;
}

.wa-image {
    background: white;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.wa-image img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    display: block;
    background-color: white;
}

:root.dark .wa-image img {
    background-color: #111b21;
}

.wa-text-box {
    background: white;
    border-radius: 0 0 8px 8px;
    padding: 12px;
    font-size: 0.875rem;
}

:root.dark .wa-text-box {
    background: #202c33;
}

.wa-text-box pre {
    white-space: pre-wrap;
    font-family: inherit;
    margin: 0;
    color: #111B21;
}

:root.dark .wa-text-box pre {
    color: #e9edef;
}

.preview-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background-color: var(--text-primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    box-shadow: var(--shadow-md);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Saved Grid */
.saved-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* Automation Master Container */
.automation-main-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

.automation-content-inner {
    padding: 0 0 40px; /* Padding bottom from old container */
}

.automation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.automation-stats {
    display: flex;
    align-items: center;
    gap: 12px;
}

.automation-stats .badge {
    background: var(--border-color);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.automation-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.automation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    transition: border-color 0.2s;
}

.automation-item .status-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
}

.automation-item.status-loading .status-icon {
    color: var(--brand-orange);
    animation: rotate 1s linear infinite;
}

.automation-item.status-success .status-icon {
    color: #25D366; /* WhatsApp Green */
}

.automation-item.status-error .status-icon {
    color: #ef4444; /* Red */
}

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

.automation-item-input {
    flex: 1;
    display: flex;
    gap: 8px;
    align-items: center;
}

.automation-item-input input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.automation-item-input input::placeholder {
    color: var(--text-muted);
}

.automation-item .btn-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.automation-item .btn-remove:hover {
    color: #ef4444;
    background: var(--border-color);
}

/* ================================================================
   LOGIN PAGE STYLES
   ================================================================ */

.login-body {
    background-color: var(--bg-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
}

.login-theme-toggle {
    position: absolute;
    top: 24px;
    right: 32px;
    z-index: 10;
    display: flex;
    align-items: center;
}

.login-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Left Pane */
.login-visual-pane {
    flex: 1.2;
    background: radial-gradient(circle at center, var(--brand-orange-light) 0%, var(--bg-main) 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px;
    overflow: hidden;
    border-right: 1px solid var(--border-color);
}

:root.dark .login-visual-pane {
    background: radial-gradient(circle at center, rgba(249, 115, 22, 0.1) 0%, #0F1117 100%);
}

.login-visual-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 500px;
    margin-bottom: 48px;
}

.login-logo-large {
    justify-content: center;
    margin-bottom: 32px;
}

.login-logo-large .logo-icon {
    width: 32px;
    height: 32px;
}

.login-logo-large h2 {
    font-size: 1.75rem;
}

.login-visual-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.login-visual-title strong {
    color: var(--brand-orange);
}

.login-visual-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.login-glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.05);
    position: relative;
    z-index: 2;
    max-width: 400px;
    width: 100%;
    transform: rotate(-2deg);
    transition: transform 0.3s ease;
}

.login-glass-card:hover {
    transform: rotate(0deg) scale(1.02);
}

:root.dark .login-glass-card {
    background: rgba(30, 35, 48, 0.7);
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.glass-text-mock {
    padding: 12px;
    background: var(--bg-main);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.glass-text-mock.primary {
    color: var(--brand-orange);
    font-weight: 600;
}

/* Right Pane */
.login-form-pane {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-card);
    padding: 32px;
}

.login-form-wrapper {
    width: 100%;
    max-width: 400px;
}

.login-logo-mobile {
    display: none;
    margin-bottom: 32px;
    justify-content: center;
}

.login-header {
    margin-bottom: 32px;
}

.login-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.login-input-group {
    margin-bottom: 20px;
    position: relative;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper .input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
    transition: color 0.2s;
}

.input-icon-wrapper input {
    width: 100%;
    padding: 12px 14px 12px 40px !important;
}

.input-icon-wrapper input:focus + .input-icon,
.input-icon-wrapper input:focus ~ .input-icon {
    color: var(--brand-orange);
}

.btn-toggle-password {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.btn-toggle-password:hover {
    color: var(--text-primary);
}

.btn-toggle-password i {
    width: 18px;
    height: 18px;
}

/* Validation Styles */
.error-message {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 6px;
    display: none;
}

.login-input-group.has-error input {
    border-color: #ef4444;
}

.login-input-group.has-error .error-message {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Checkbox and Links */
.login-options {
    font-size: 0.875rem;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    user-select: none;
}

.custom-checkbox input {
    opacity: 0;
    position: absolute;
    cursor: pointer;
}

.checkmark {
    width: 18px;
    height: 18px;
    background: transparent;
    border: 1px solid var(--border-hover);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: var(--brand-orange);
    border-color: var(--brand-orange);
}

.custom-checkbox input:checked ~ .checkmark::after {
    content: "";
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.forgot-password-link {
    color: var(--brand-orange);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.forgot-password-link:hover {
    color: var(--brand-orange-hover);
    text-decoration: underline;
}

.btn-login {
    padding: 14px;
    font-size: 1rem;
    margin-top: 8px;
}

.login-separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.login-separator::before,
.login-separator::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.login-separator span {
    padding: 0 10px;
}

.signup-prompt {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.signup-prompt a {
    color: var(--brand-orange);
    text-decoration: none;
    font-weight: 600;
}

.signup-prompt a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 1024px) {
    .login-visual-pane {
        padding: 32px;
        flex: 1;
    }
    .login-visual-title {
        font-size: 2rem;
    }

    .result-card {
        flex-direction: column;
    }
    .result-image-pane {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 24px;
    }
    .result-text-pane {
        width: 100%;
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .login-visual-pane {
        display: none;
    }
    .login-logo-mobile {
        display: flex;
    }

    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .top-header {
        display: none;
    }
}

/* ================================================================
   AUTOMATION: TABS & GOOGLE SHEETS
   ================================================================ */
.automation-tabs {
    display: flex;
    gap: 32px;
    margin: 0 0 32px 0;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 12px 0;
    font-weight: 600;
    font-size: 0.9375rem;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -1px; /* Align with bottom border */
}

.tab-btn i, .tab-btn svg {
    width: 18px;
    height: 18px;
}

.tab-btn:hover {
    color: var(--brand-orange);
}

.tab-btn.active {
    color: var(--brand-orange);
    border-bottom-color: var(--brand-orange);
}

/* Responsividade Mobile para Tabs */
@media (max-width: 640px) {
    .automation-tabs {
        gap: 20px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .automation-tabs::-webkit-scrollbar { display: none; }
    .tab-btn {
        flex-shrink: 0;
        font-size: 0.875rem;
    }
}

.sheet-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.metric-card .metric-title {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-bottom: 8px;
}

.metric-card .metric-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.pending-color { color: var(--text-primary); }
.success-color { color: #10B981; }
.error-color { color: #ef4444; }

.sheet-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

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

.sheet-list-item:hover {
    background-color: rgba(0,0,0,0.01);
}

:root.dark .sheet-list-item:hover {
    background-color: rgba(255,255,255,0.02);
}

.sheet-list-item .item-url {
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 65%;
}

.sheet-list-item .item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-pill {
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-pill-pending { background: #F3F4F6; color: #4B5563; }
.status-pill-processing { background: #FEF3C7; color: #D97706; }
.status-pill-success { background: #D1FAE5; color: #059669; }
.status-pill-error { background: #FEE2E2; color: #DC2626; }

:root.dark .status-pill-pending { background: #374151; color: #D1D5DB; }
:root.dark .status-pill-processing { background: rgba(245, 158, 11, 0.2); color: #FCD34D; }
:root.dark .status-pill-success { background: rgba(16, 185, 129, 0.2); color: #34D399; }
:root.dark .status-pill-error { background: rgba(239, 68, 68, 0.2); color: #F87171; }

/* ================================================================
   ACCOUNT VIEW – NEW
   ================================================================ */

.account-container {
    max-width: 900px;
    margin: 40px auto;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.account-header {
    margin-bottom: 40px;
}

.account-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .account-grid {
        grid-template-columns: 1fr;
    }
}

.account-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

.account-card:hover {
    transform: translateY(-2px);
}

.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 32px;
}

.profile-avatar-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 16px;
}

.profile-img {
    width: 100%;
    height: 100%;
    border-radius: 30px;
    object-fit: cover;
    border: 2px solid var(--brand-orange);
}

.profile-avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 30px;
    background: var(--brand-orange-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-orange);
    border: 1px dashed var(--brand-orange);
}

.profile-avatar-placeholder i {
    width: 40px;
    height: 40px;
}

.avatar-upload-btn {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 32px;
    height: 32px;
    background: var(--brand-orange);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: transform 0.2s;
}

.avatar-upload-btn:hover {
    transform: scale(1.1);
}

.profile-title h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-title p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input {
    height: 48px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 4px var(--brand-orange-light);
}

.form-group input[readonly] {
    opacity: 0.7;
    cursor: not-allowed;
}

.form-divider {
    height: 1px;
    background: var(--border-color);
    margin: 10px 0;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    color: var(--brand-orange);
}

.card-title h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}
