/* ============================================
   LifeGrid - Redesign 2025
   Theme: Aurora Deep Space
   ============================================ */

/* === Variables === */
:root {
    /* Base Palette */
    --bg-root: #000000;
    --bg-card: rgba(28, 28, 30, 0.65);
    --bg-card-hover: rgba(44, 44, 46, 0.75);
    --bg-input: rgba(118, 118, 128, 0.12);
    --bg-input-focus: rgba(118, 118, 128, 0.24);
    
    /* Text */
    --text-primary: #FFFFFF;
    --text-secondary: rgba(235, 235, 245, 0.6);
    --text-tertiary: rgba(235, 235, 245, 0.3);

    /* Accents */
    --accent: #8B5CF6; /* Default, will be overridden by JS inline styles if needed */
    --accent-glow: rgba(139, 92, 246, 0.5);
    
    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);

    /* Layout */
    --sidebar-width: 420px;
    --header-height: 60px;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 32px;
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

html {
    font-size: 16px;
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    background-color: var(--bg-root);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100%;
    overflow-x: hidden;
}

/* === Background Effects === */
.bg-gradient {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(76, 29, 149, 0.15), transparent 60%),
                radial-gradient(circle at 80% 20%, rgba(56, 189, 248, 0.1), transparent 50%);
    z-index: -2;
    animation: drift 30s infinite alternate linear;
    pointer-events: none;
}

.bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    z-index: -1;
    pointer-events: none;
}

@keyframes drift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-20px, -20px) rotate(5deg); }
}

/* === Layout === */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Left Column: Preview */
.preview-pane {
    width: calc(100% - var(--sidebar-width));
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-right: 1px solid var(--border-subtle);
    background: radial-gradient(circle at center, rgba(255,255,255,0.03) 0%, transparent 70%);
}

.app-header {
    position: absolute;
    top: 0;
    left: 0;
    padding: 24px 32px;
    width: 100%;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.02em;
    opacity: 0.9;
}

.preview-container {
    padding: 40px;
    transform: scale(0.9); /* Default slightly smaller */
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Phone Mockup */
.phone-mockup {
    width: 320px;
    height: 680px;
    background: #000;
    border-radius: 50px;
    padding: 12px;
    box-shadow: 
        0 0 0 4px #333,
        0 0 0 7px #111,
        0 50px 100px -20px rgba(0,0,0,0.7);
    position: relative;
    user-select: none;
}

.phone-notch {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 28px;
    background: #000;
    border-radius: 20px;
    z-index: 20;
}

.phone-screen {
    width: 100%;
    height: 100%;
    background: #050505;
    border-radius: 40px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.phone-reflection {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 40%);
    border-radius: 50px;
    pointer-events: none;
    z-index: 30;
}

#preview-canvas {
    width: 100%;
    height: 100%;
    display: flex;
}

#preview-canvas canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

.preview-actions-mobile {
    display: none; /* Desktop hidden */
}

/* Right Column: Controls */
.controls-pane {
    width: var(--sidebar-width);
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-left: 1px solid var(--border-subtle);
    height: 100vh;
    overflow-y: auto;
}

.controls-content {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    min-height: 100%;
}

/* Status Card */
.status-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.status-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.status-info {
    flex: 1;
}

.status-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.status-text {
    font-size: 14px;
    color: var(--text-primary);
}

.status-text span {
    font-weight: 700;
    color: var(--accent);
}

/* Control Groups */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.group-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

/* Type Grid */
.types-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.type-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.type-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.type-card.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    box-shadow: 0 0 20px -5px var(--accent-glow);
}

.type-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.type-card.active .type-icon {
    background: var(--accent);
    color: #fff;
}

.type-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.type-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Inputs */
.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.select-wrapper {
    position: relative;
}

.select-input, .text-input {
    width: 100%;
    height: 44px;
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 0 16px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    appearance: none;
}

.select-input:hover, .text-input:hover {
    background: var(--bg-input-focus);
}

.select-input:focus, .text-input:focus {
    background: var(--bg-input-focus);
    border-color: var(--accent);
}

.select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-secondary);
}

/* Color Scroll */
.color-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.color-btn {
    flex: 0 0 44px;
    height: 44px;
    border-radius: 12px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    padding: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.color-btn.active {
    border-color: var(--text-primary);
    transform: scale(1.1);
}

.color-swatch {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

/* Range Input */
.range-input {
    width: 100%;
    -webkit-appearance: none;
    background: transparent;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-input);
    margin: 10px 0;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    margin-top: -7px; /* Align vertical */
}

.range-input::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: var(--bg-input);
    border-radius: 3px;
}

.highlight-value {
    color: var(--accent);
    margin-left: 8px;
}

/* Animation for dynamic config */
.dynamic-config-area {
    min-height: 20px;
}

.extra-config {
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Export / URL */
.url-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-subtle);
}

.url-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.url-input {
    flex: 1;
    background: #000;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 0 12px;
    color: var(--text-secondary);
    font-family: 'SF Mono', monospace;
    font-size: 12px;
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--text-primary);
    color: #000;
    border: none;
    padding: 0 16px;
    height: 36px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-primary:active {
    transform: scale(0.95);
}

.hint-text {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Guide Accordion */
.guide-accordion details summary {
    display: flex;
    align-items: center;
    gap: 12px;
    list-style: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    padding: 12px 0;
}

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

.guide-accordion .arrow {
    margin-left: auto;
    transition: transform 0.2s;
}

.guide-accordion details[open] .arrow {
    transform: rotate(180deg);
}

.guide-body {
    padding-top: 8px;
    padding-bottom: 20px;
    border-top: 1px solid var(--border-subtle);
}

.guide-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.guide-tab {
    flex: 1;
    padding: 8px;
    background: var(--bg-input);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}

.guide-tab.active {
    background: var(--bg-input-focus);
    color: var(--text-primary);
    font-weight: 600;
}

.guide-panel { display: none; }
.guide-panel.active { display: block; }

.guide-panel ol {
    margin-left: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
}

.app-footer {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
    margin-top: auto;
    padding-top: 20px;
}

/* === Mobile Responsive === */
@media (max-width: 900px) {
    .app-layout {
        flex-direction: column;
    }

    .preview-pane {
        width: 100%;
        height: auto;
        padding: 80px 20px 40px;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }

    .preview-container {
        transform: scale(0.8);
        padding: 0;
    }

    .controls-pane {
        width: 100%;
        height: auto;
        overflow-y: visible;
        border-left: none;
    }

    .controls-content {
        padding: 24px 20px;
    }

    /* Mobile Floating Button */
    .preview-actions-mobile {
        display: block;
        margin-top: 20px;
    }

    .btn-floating {
        background: rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: white;
        padding: 12px 24px;
        border-radius: 30px;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 8px;
        cursor: pointer;
    }
}

/* === Guide Step List === */
.step-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 12px;
}

.step-item {
    display: flex;
    gap: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.step-badge {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    margin-top: 2px;
}

.step-text strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

code {
    background: rgba(255,255,255,0.1);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

/* === Modern Timeline Guide Design === */
.step-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 20px 0;
    position: relative;
}

/* Timeline Line */
.step-list::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 30px;
    bottom: 30px;
    width: 2px;
    background: var(--border-subtle);
    z-index: 0;
}

.step-item {
    display: flex;
    gap: 20px;
    position: relative;
    z-index: 1;
}

/* Step Badge (Icon/Number) */
.step-badge {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 50%; /* Circle */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.step-item:hover .step-badge {
    transform: scale(1.1);
    border-color: var(--accent);
}

/* Step Content Card */
.step-content-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 16px;
    transition: all 0.2s;
}

.step-item:hover .step-content-card {
    background: var(--bg-card-hover);
    transform: translateX(4px);
    border-color: var(--border-light);
}

.step-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Highlights & Code */
.highlight-box {
    background: rgba(139, 92, 246, 0.1);
    border-left: 3px solid var(--accent);
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-primary);
}

.highlight-warn {
    background: rgba(248, 113, 113, 0.1);
    border-left: 3px solid var(--accent-red);
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 13px;
    color: #ffcccc;
}

code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', monospace;
    font-size: 0.9em;
    color: var(--accent-blue);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Icons in title */
.icon-small {
    width: 16px;
    height: 16px;
    opacity: 0.8;
}
