/* Mobile First Extreme Responsive & Glassmorphism Design */

:root {
    --bg-dark: #1a1a1a;
    --primary: #dc2626;
    --primary-hover: #b91c1c;
    --secondary: #22c55e;
    --secondary-hover: #16a34a;
    --text-main: #f8fafc;
    --text-muted: #c0c0c0;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

html, body {
    width: 100%;
    margin: 0;
    padding: 0;
    background-color: #0f172a;
}

body.app-page {
    height: 100vh;
    overflow: hidden; /* Remove scroller for the app */
}

body {
    min-height: 100vh;
    background: linear-gradient(-45deg, #450a0a, #064e3b, #374151, #450a0a);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

/* Glassmorphism Panel Base */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    width: 100%;
    overflow-y: hidden;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.6s ease-out;
}

.glass-panel::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

.glass-panel-inner {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Typography & Gradients */
.gradient-text {
    background: linear-gradient(to right, #818cf8, #f472b6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 800;
}

h1, h2, h3 {
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

h3 {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* Landing Page Specific */
.landing-page {
    justify-content: center;
    align-items: center;
}

.landing-container {
    text-align: center;
    align-items: center;
}

.landing-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.2));
    animation: float 6s ease-in-out infinite;
}

.landing-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* App Header */
.app-header {
    text-align: center;
    position: relative;
}

.full-header {
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 10;
}
.full-header h2 { margin: 0; }

/* Split Layout Specifics */
.full-screen-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px);
    overflow: hidden;
}

.upload-state {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.massive-drop-zone {
    width: 100%;
    max-width: 800px;
    min-height: 400px;
    border-width: 4px;
    font-size: 1.2rem;
}
.massive-drop-zone .upload-icon { font-size: 5rem; margin-bottom: 1rem; }

.editor-state {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 5px 380px;
    height: 100%;
}

.resizer {
    width: 5px;
    background: rgba(255, 255, 255, 0.1);
    cursor: col-resize;
    z-index: 10;
    transition: background 0.2s;
}

.resizer:hover, .resizer:active {
    background: var(--primary);
}

.preview-pane {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.canvas-container {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.live-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: transform 0.2s;
}

.sidebar-pane {
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-right: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sidebar-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    height: 100%;
}
.sidebar-scrollable::-webkit-scrollbar { width: 0px; }

@media (max-width: 768px) {
    .editor-state {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        overflow-y: auto;
    }
    .full-screen-main { height: auto; overflow: auto; }
    .sidebar-pane { border-left: none; border-top: 1px solid var(--glass-border); }
    .live-image { max-height: 50vh; }
    .preview-pane { padding: 1rem; }
}

.back-link {
    position: absolute;
    left: 0;
    top: 5px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--text-main);
    transform: translateX(-4px);
}

/* Buttons */
.btn-primary, .btn-secondary {
    display: inline-block;
    width: 100%;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-large {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
}

/* Drop Zone */
.drop-zone {
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.drop-zone:hover, .drop-zone.drag-active {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

/* Images */
.image-preview {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    margin-bottom: 1rem;
}

/* Settings Sections */
.settings-group {
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid var(--glass-border);
}

details > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    outline: none;
    display: flex;
    align-items: center;
}

details > summary::-webkit-details-marker {
    display: none;
}

details > summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 10px;
    font-size: 0.8rem;
    color: var(--primary);
    transition: transform 0.3s;
}

details[open] > summary::before {
    transform: rotate(90deg);
}

details > summary h3 {
    margin-bottom: 0;
    display: inline-block;
}

.transform-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

.resolution-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.x-divider {
    color: var(--text-muted);
    font-weight: bold;
}

/* Form Elements */
input[type="number"], .custom-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

input[type="number"]:focus, .custom-select:focus {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.3);
}

.custom-select option {
    background: #1e1b4b;
    color: white;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Sliders */
.slider-container label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.slider-container label:first-child {
    margin-top: 0;
}

.value-badge {
    background: rgba(255,255,255,0.1);
    padding: 0.1rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-family: monospace;
}

.custom-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.2);
    outline: none;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Info Box */
.image-info {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
}
.image-info strong {
    color: var(--text-main);
}

/* Footer */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    z-index: 10;
}
.app-footer img {
    height: 24px;
}

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

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

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Media Queries */
@media (min-width: 640px) {
    .glass-panel {
        max-width: 600px;
        padding: 3rem 2.5rem;
    }
    
    .settings-section {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
    
    .settings-group {
        margin-bottom: 0;
    }
    
    .settings-group:last-child {
        grid-column: span 2;
    }
}
