:root {
    --bg-main: #0B0F19;
    --bg-card: #111827;
    --bg-card-hover: #1F2937;
    --border-color: #374151;
    --border-focus: #10B981;
    --primary: #10B981;
    --primary-dark: #059669;
    --primary-glow: rgba(16, 185, 129, 0.25);
    --text-main: #F9FAFB;
    --text-muted: #9CA3AF;
    --text-hint: #6B7280;
    --danger: #EF4444;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

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

/* Navbar */
.navbar {
    border-bottom: 1px solid var(--border-color);
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #10B981, #059669);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.logo-icon svg {
    width: 22px;
    height: 22px;
}

.brand-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.badge-free {
    background: rgba(16, 185, 129, 0.15);
    color: #34D399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 9999px;
    text-transform: uppercase;
}

.nav-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: #4B5563;
}

.btn-icon {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    color: var(--text-main);
    background: var(--bg-card-hover);
    border-color: #4B5563;
}

/* Layout */
.main-wrapper {
    flex: 1;
    padding: 40px 24px;
    display: flex;
    justify-content: center;
}

.content-container {
    max-width: 1200px;
    width: 100%;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 48px;
    align-items: start;
}

@media (max-width: 960px) {
    .content-container {
        grid-template-columns: 1fr;
    }
}

/* Hero & Form */
.hero-text {
    margin-bottom: 24px;
}

.hero-text h2 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 8px;
}

.hero-text h2 span {
    background: linear-gradient(135deg, #34D399, #10B981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-text p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.card-form {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.input-wrapper input,
.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="password"] {
    width: 100%;
    background: #0D131F;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: var(--font-main);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper input:focus,
.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.field-hint {
    font-size: 0.78rem;
    color: var(--text-hint);
}

/* Icon Upload */
.icon-upload-container {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #0D131F;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: border-color 0.2s;
}

.icon-upload-container.drag-over {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.05);
}

.icon-preview-box {
    width: 64px;
    height: 64px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.icon-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#iconPlaceholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-hint);
    text-align: center;
}

#iconPlaceholder span {
    display: none;
}

.btn-select-file {
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-select-file:hover {
    background: #374151;
}

/* Color Picker */
.color-picker-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.color-preset-list {
    display: flex;
    gap: 8px;
}

.color-preset {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.color-preset:hover {
    transform: scale(1.1);
}

.color-preset.active {
    border-color: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

.custom-color-input {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0D131F;
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: var(--radius-md);
}

.custom-color-input input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
}

.custom-color-input input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.custom-color-input input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

#colorHexText {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Advanced Settings Accordion */
.advanced-settings {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.advanced-settings summary {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    outline: none;
    user-select: none;
    transition: color 0.2s;
}

.advanced-settings summary:hover {
    color: var(--text-main);
}

.advanced-content {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #10B981, #059669);
    border: none;
    color: white;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

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

/* Phone Mockup */
.preview-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-header {
    text-align: center;
    margin-bottom: 24px;
}

.preview-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

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

.phone-frame {
    width: 310px;
    height: 610px;
    background: #1E293B;
    border: 10px solid #273549;
    border-radius: 44px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.phone-speaker {
    width: 50px;
    height: 4px;
    background: #334155;
    border-radius: 4px;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.phone-camera {
    width: 10px;
    height: 10px;
    background: #0f172a;
    border-radius: 50%;
    position: absolute;
    top: 6px;
    left: calc(50% + 40px);
    z-index: 10;
}

.phone-screen {
    width: 100%;
    height: 100%;
    background: #FFFFFF;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mockup-status-bar {
    height: 28px;
    background: #0B8043;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    transition: background 0.3s ease;
}

.mockup-app-header {
    height: 52px;
    background: #0F9D58;
    color: white;
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: background 0.3s ease;
}

.mockup-app-icon {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mockup-app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mockup-title {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mockup-webview-body {
    flex: 1;
    background: #F8FAFC;
    padding: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Sheets Mockup Table */
.sheets-mockup-table {
    background: white;
    border-radius: 8px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    overflow: hidden;
}

.table-header-row {
    background: #F1F5F9;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1fr;
    padding: 8px 10px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #475569;
    border-bottom: 1px solid #E2E8F0;
}

.table-data-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1fr;
    padding: 8px 10px;
    font-size: 0.68rem;
    color: #334155;
    border-bottom: 1px solid #F1F5F9;
    align-items: center;
}

.table-data-row:last-child {
    border-bottom: none;
}

.tag {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    text-align: center;
    width: fit-content;
}

.tag-ok {
    background: #DCFCE7;
    color: #15803D;
}

.tag-warn {
    background: #FEF3C7;
    color: #B45309;
}

.mockup-fab {
    position: absolute;
    bottom: 24px;
    right: 18px;
    width: 44px;
    height: 44px;
    background: #0F9D58;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    transition: background 0.3s ease;
}

.mockup-nav-bar {
    height: 18px;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-bar-indicator {
    width: 72px;
    height: 4px;
    background: #CBD5E1;
    border-radius: 4px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: modalPop 0.25s ease;
}

@keyframes modalPop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.btn-close:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
}

/* Build Steps */
.build-loader-box {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.build-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.step-item.active {
    opacity: 1;
}

.step-item.completed {
    opacity: 0.9;
}

.step-bullet {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1F2937;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.step-item.active .step-bullet {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 12px var(--primary-glow);
}

.step-item.completed .step-bullet {
    background: #059669;
    color: white;
}

.step-text {
    display: flex;
    flex-direction: column;
    font-size: 0.88rem;
}

.step-text span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Success Box */
.success-box {
    text-align: center;
    padding: 10px 0;
}

.success-icon {
    margin-bottom: 12px;
}

.success-box h4 {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.success-box p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.btn-download {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    text-decoration: none;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-size: 1.05rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 6px 20px var(--primary-glow);
    transition: all 0.2s ease;
}

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

.qr-container {
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qr-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

#qrCodeWrapper {
    background: white;
    padding: 12px;
    border-radius: var(--radius-md);
    display: inline-block;
}

#qrCodeImg {
    width: 140px;
    height: 140px;
    display: block;
}

/* Error Box */
.error-box {
    text-align: center;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    padding: 20px;
}

.error-icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

.error-box h4 {
    color: var(--danger);
    font-size: 1.15rem;
    margin-bottom: 6px;
}

.error-box p {
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* Tutorial */
.tutorial-steps {
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-size: 0.9rem;
}

.tutorial-steps li strong {
    color: var(--text-main);
}

.tutorial-steps li p {
    color: var(--text-muted);
    margin-top: 2px;
}

.tutorial-steps code {
    background: #1F2937;
    color: #34D399;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85em;
}

.settings-intro {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}
