/* ========================================
   SVG Paper Globe Maker - Design System
   ======================================== */

/* CSS Variables */
:root {
    /* Colors - Dark Theme */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --bg-elevated: #22222e;
    
    --surface-1: rgba(255, 255, 255, 0.03);
    --surface-2: rgba(255, 255, 255, 0.06);
    --surface-3: rgba(255, 255, 255, 0.09);
    
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-tertiary: rgba(255, 255, 255, 0.5);
    --text-muted: rgba(255, 255, 255, 0.35);
    
    --accent-primary: #6366f1;
    --accent-primary-hover: #818cf8;
    --accent-secondary: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --gradient-glow: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(255, 255, 255, 0.15);
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Effects */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-glow);
    pointer-events: none;
    z-index: 0;
}

/* App Container */
.app-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--space-6);
}

/* Header */
.app-header {
    text-align: center;
    padding: var(--space-8) 0;
    margin-bottom: var(--space-6);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.logo-icon {
    font-size: 2.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.logo h1 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
    font-weight: 300;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: var(--space-6);
    flex: 1;
}

/* Control Panel */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.panel-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: border-color var(--transition-normal);
}

.panel-section:hover {
    border-color: var(--border-color-hover);
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.section-icon {
    font-size: 1.1rem;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-8);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--surface-1);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area.dragover {
    transform: scale(1.02);
}

.upload-icon {
    color: var(--text-tertiary);
    margin-bottom: var(--space-3);
    transition: color var(--transition-normal);
}

.upload-area:hover .upload-icon {
    color: var(--accent-primary);
}

.upload-text {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

.upload-hint {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

/* Upload Preview */
.upload-preview {
    background: var(--surface-1);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin-top: var(--space-3);
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.file-name {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-family: monospace;
}

.preview-image {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.preview-image svg {
    max-width: 100%;
    max-height: 100px;
}

/* Settings */
.setting-group {
    margin-bottom: var(--space-5);
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.setting-value {
    color: var(--accent-primary);
    font-weight: 500;
}

/* Button Group */
.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}

.button-group-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.btn-toggle {
    padding: var(--space-2) var(--space-3);
    background: var(--surface-1);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-toggle:hover {
    background: var(--surface-2);
    border-color: var(--border-color-hover);
}

.btn-toggle.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Range Slider */
.range-slider {
    width: 100%;
    height: 6px;
    background: var(--surface-2);
    border-radius: var(--radius-full);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--bg-secondary);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast);
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

/* Buttons */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--surface-1);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-4);
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: var(--font-size-base);
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 60px rgba(99, 102, 241, 0.4);
}

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

.btn-icon-left {
    display: flex;
}

/* Preview Panel */
.preview-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.preview-header-bar .section-title {
    margin-bottom: 0;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.zoom-level {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    min-width: 50px;
    text-align: center;
}

.preview-canvas-wrapper {
    flex: 1;
    overflow: auto;
    padding: var(--space-6);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    background-image: 
        linear-gradient(45deg, var(--surface-1) 25%, transparent 25%),
        linear-gradient(-45deg, var(--surface-1) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--surface-1) 75%),
        linear-gradient(-45deg, transparent 75%, var(--surface-1) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.preview-canvas {
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 400px;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-normal);
}

.empty-state {
    text-align: center;
    color: #666;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state p {
    margin: var(--space-1) 0;
    color: #999;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: var(--space-6) 0 var(--space-2);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.app-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.app-footer a:hover {
    color: var(--accent-primary-hover);
}

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .control-panel {
        order: 1;
    }
    
    .preview-panel {
        order: 0;
        min-height: 400px;
    }
}

@media (max-width: 640px) {
    .app-container {
        padding: var(--space-4);
    }
    
    .logo h1 {
        font-size: var(--font-size-xl);
    }
    
    .tagline {
        font-size: var(--font-size-base);
    }
    
    .preview-canvas {
        min-width: 300px;
        min-height: 400px;
    }
}

/* Template SVG Styles (for the generated output) */
.template-svg {
    width: 100%;
    height: 100%;
}

.template-svg .cut-line {
    stroke: #333;
    stroke-width: 0.5;
    fill: none;
}

.template-svg .fold-line-dashed {
    stroke: #666;
    stroke-width: 0.3;
    stroke-dasharray: 4, 2;
    fill: none;
}

.template-svg .fold-line-dotted {
    stroke: #666;
    stroke-width: 0.3;
    stroke-dasharray: 1, 2;
    fill: none;
}

.template-svg .glue-tab {
    fill: #f0f0f0;
    stroke: #ccc;
    stroke-width: 0.3;
}

.template-svg .face-content {
    /* User's SVG will be clipped here */
}
