:root {
    --bg-color: #0b0f19;
    --sidebar-bg: #111827;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #a1b0cd;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.35);
    --danger: #ef4444;
    --success: #22c55e;
    --radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 40%);
}

.app-container {
    display: flex;
    flex: 1;
    width: 100%;
}

/* Glassmorphism Effect */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Sidebar */
.sidebar {
    width: clamp(290px, 28vw, 420px);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 16px;
    overflow-y: auto;
    z-index: 10;
    -webkit-overflow-scrolling: touch;
}

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

.brand-logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 15px var(--accent-glow);
}

.brand h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.badge-pro {
    font-size: 0.65rem;
    background: linear-gradient(135deg, #6366f1, #06b6d4);
    color: white;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
    vertical-align: middle;
    margin-left: 4px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card h2, .card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Presets */
.preset-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.preset-tag {
    background: rgba(51, 65, 85, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 12px;
    min-height: 36px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.preset-tag:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-1px);
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.4);
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition);
}

.prompt-group {
    position: relative;
}

.tweak-bar {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.tweak-bar input {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.tweak-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tweak-btn:hover:not(:disabled) {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

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

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea {
    resize: none;
}

/* Sliders Accordion Styles */
.sliders-accordion {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
}

.sliders-accordion summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.sliders-accordion summary::-webkit-details-marker {
    display: none;
}

.sliders-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(15, 23, 42, 0.4);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-top: 10px;
}

.slider-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.slider-label-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slider-val {
    font-size: 0.75rem;
    font-weight: 600;
    color: #818cf8;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(51, 65, 85, 0.8);
    border-radius: 3px;
    outline: none;
    padding: 0;
    border: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

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

.password-wrapper input {
    width: 100%;
    padding-right: 40px;
}

.password-wrapper button {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

details.card {
    cursor: pointer;
}

details.card summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

details.card summary::-webkit-details-marker {
    display: none;
}

.api-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 12px 16px;
    min-height: 44px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

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

.btn-glow {
    position: relative;
}

.btn-secondary {
    background-color: #334155;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: #475569;
}

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

.btn-action {
    background-color: rgba(51, 65, 85, 0.8);
    color: var(--text-primary);
    flex: 1;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}

.btn-action:hover:not(:disabled) {
    background-color: var(--accent);
    border-color: var(--accent);
}

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

.btn-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    min-height: 32px;
    padding: 4px 8px;
}

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

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: transparent;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(8px);
    flex-wrap: wrap;
    gap: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}

/* Tabs */
.tab-triggers {
    display: flex;
    gap: 4px;
    background: rgba(15, 23, 42, 0.7);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 14px;
    min-height: 38px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active, .tab-btn:hover {
    background-color: var(--accent);
    color: white;
}

.workspace {
    padding: 28px;
    max-width: none;
    width: 100%;
    margin: 0 auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Studio Grid */
.studio-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

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

.resolution-badge {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
}

.canvas-container {
    width: 100%;
    aspect-ratio: 1;
    max-width: min(100%, 55vh);
    margin: 0 auto;
    background: repeating-conic-gradient(rgba(30, 41, 59, 0.6) 0% 25%, rgba(15, 23, 42, 0.8) 0% 50%) 50% / 16px 16px;
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: inset 0 4px 20px rgba(0,0,0,0.5);
}

#logoCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.placeholder-state {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    text-align: center;
    padding: 20px;
}

.placeholder-icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(51, 65, 85, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

/* AI Loader */
.loader {
    position: absolute;
    inset: 0;
    background-color: rgba(11, 15, 25, 0.9);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 10;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

.hidden {
    display: none !important;
}

.ai-pulse-loader {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: pulseRing 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulseRing {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

.spinner {
    animation: rotate 1.2s linear infinite;
}

.spinner circle {
    stroke: var(--accent);
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

.action-buttons {
    display: flex;
    gap: 8px;
    width: 100%;
}

.history-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
}

.history-empty {
    grid-column: span 3;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
    padding: 30px 0;
}

.history-item {
    aspect-ratio: 1;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: repeating-conic-gradient(rgba(30, 41, 59, 0.5) 0% 25%, rgba(15, 23, 42, 0.7) 0% 50%) 50% / 10px 10px;
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition);
}

.history-item:hover {
    border-color: var(--accent);
    transform: scale(1.05);
    box-shadow: 0 0 12px var(--accent-glow);
}

.history-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Mockups Tab */
.mockups-header, .guidelines-header {
    margin-bottom: 20px;
}

.mockups-header h2, .guidelines-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.mockups-header p, .guidelines-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.mockup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.mockup-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mockup-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.mockup-stage {
    width: 100%;
    height: 180px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* App Icon Stage */
.app-icon-stage {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    flex-direction: column;
    gap: 8px;
}

.phone-app-icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: #000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    overflow: hidden;
    border: 1.5px solid rgba(255,255,255,0.15);
}

.phone-app-icon canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.app-label {
    font-size: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Browser Favicon Stage */
.browser-stage {
    background: #1e293b;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
}

.browser-bar {
    height: 32px;
    background: #0f172a;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.browser-dots {
    display: flex;
    gap: 6px;
}

.browser-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #334155;
}

.browser-tab {
    background: #1e293b;
    padding: 4px 10px;
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom: none;
}

.browser-tab canvas {
    width: 14px;
    height: 14px;
}

.browser-body {
    flex: 1;
    background: #090d16;
    padding: 12px;
}

.browser-content-placeholder {
    width: 100%;
    height: 100%;
    background: rgba(51, 65, 85, 0.2);
    border-radius: 6px;
}

/* Business Card Stage */
.business-card-stage {
    background: linear-gradient(135deg, #111827, #1f2937);
    perspective: 1000px;
}

.visite-card {
    width: 220px;
    height: 130px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.4);
    transform: rotateX(5deg) rotateY(-10deg);
}

.vc-logo {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    overflow: hidden;
}

.vc-logo canvas {
    width: 100%;
    height: 100%;
}

.vc-info h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
}

.vc-info p {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

/* Signage Stage */
.signage-stage {
    background: #0b0f19;
    background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 16px 16px;
}

.office-wall {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.signage-logo-wrap {
    width: 56px;
    height: 56px;
    filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.5));
}

.signage-logo-wrap canvas {
    width: 100%;
    height: 100%;
}

.signage-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    letter-spacing: 3px;
    font-weight: 700;
    color: #f8fafc;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

/* Guidelines Tab */
.guidelines-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
}

.guidelines-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.palette-swatches {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

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

.swatch-color {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.swatch-info {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-primary);
}

.typography-specimen {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.typo-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.typo-role {
    font-size: 0.7rem;
    color: var(--accent);
    text-transform: uppercase;
    font-weight: 700;
}

.typo-card h4 {
    font-size: 1.1rem;
    font-weight: 700;
}

.typo-sample {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.code-output-wrapper {
    position: relative;
    background: #05080f;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
}

pre {
    font-family: monospace;
    font-size: 0.8rem;
    color: #38bdf8;
    overflow-x: auto;
    max-height: 180px;
}

.code-output-wrapper button {
    position: absolute;
    top: 12px;
    right: 12px;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    bottom: 20px;
    z-index: 1000;
}

.btn-zip {
    background: var(--accent) !important;
    color: white !important;
    border-color: var(--accent) !important;
}
.btn-zip:hover:not(:disabled) {
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.toast {
    background-color: var(--sidebar-bg);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    font-size: 0.85rem;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
}

.toast.error {
    border-color: var(--danger);
}

.toast.success {
    border-color: var(--success);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(10px); }
}

@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        max-height: none;
    }
    .studio-grid {
        grid-template-columns: 1fr;
    }
}


/* Compact desktop & Windows 125%-150% scaling (1280x600 - 1536x750) */
@media (min-width: 1025px) and (max-width: 1500px), (min-width: 1025px) and (max-height: 820px) {
    .sidebar {
        padding: 16px;
        gap: 14px;
    }

    .sidebar-header {
        padding-bottom: 10px;
    }

    .controls {
        gap: 12px;
    }

    .top-bar {
        padding: 12px 20px;
    }

    .workspace {
        padding: 16px;
    }

    .studio-grid {
        gap: 16px;
    }

    .canvas-container {
        max-width: min(100%, 46vh);
    }

    .history-grid {
        max-height: 180px;
    }
}

.generate-actions-row {
    display: flex;
    gap: 10px;
}

.flex-2 {
    flex: 2;
}

.flex-1 {
    flex: 1;
}
