/* Luminous Gradient Editor - Styles */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000;
    color: #fff;
}

.container {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
}

.canvas-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

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

#controls {
    position: absolute;
    top: 20px;
    right: 20px;
    bottom: 180px;
    width: 340px;
    background: rgba(255, 255, 255, 0.15);
    padding: 0;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(80px) saturate(150%);
    -webkit-backdrop-filter: blur(80px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

#controls-inner {
    padding: 16px;
    height: 100%;
    width: 100%;
    overflow-y: auto;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 8%, black 92%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, black 8%, black 92%, transparent 100%);
}

.export-panel {
    position: absolute;
    right: 20px;
    bottom: 20px;
    width: 340px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(80px) saturate(150%);
    -webkit-backdrop-filter: blur(80px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: right 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) 0.25s, opacity 0.3s ease 0.25s;
    opacity: 1;
}

#controls.picker-open ~ .export-panel {
    right: 380px;
    transition: right 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.3s ease;
}

#controls.hidden ~ .export-panel {
    right: -340px;
    opacity: 0;
    transition: right 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.3s ease;
}

#controls.returning-from-picker ~ .export-panel {
    transition: right 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.3s ease;
}

h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

h2 {
    font-size: 13px;
    font-weight: 500;
    margin: 24px 0 16px 0;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stroke-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.color-preview {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    flex: 0 0 36px;
}

.hex-code {
    font-size: 13px;
    font-family: 'SF Mono', Monaco, monospace;
    flex: 1;
    color: rgba(255,255,255,0.7);
}

.stroke-toggle {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(80px) saturate(150%);
    -webkit-backdrop-filter: blur(80px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 20px;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex: 0 0 36px;
}

.stroke-toggle:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
    transform: none;
}

.slider-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    gap: 12px;
}

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

.slider-label {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.slider-input {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: transform 0.1s;
}

.slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider-input::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.slider-value {
    font-size: 15px;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
    font-family: 'SF Mono', Monaco, monospace;
    background: transparent;
    border: none;
    text-align: right;
    width: 50px;
    outline: none;
}

.slider-value:focus {
    color: #fff;
}

.global-section {
    background: transparent;
    padding: 0;
    margin-bottom: 20px;
}

.settings-container {
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(255,255,255,0.1);
}

.settings-container .slider-row:last-child {
    margin-bottom: 0;
}

#controls-inner > .settings-container:last-of-type {
    margin-bottom: 0;
}

.stroke-section {
    margin-bottom: 24px;
}

.stroke-section:last-child {
    margin-bottom: 0;
}

.button-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

button {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

button:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-1px);
}

.btn-primary {
    background: rgba(255,255,255,0.2);
}

.btn-primary:hover {
    background: rgba(255,255,255,0.3);
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
}

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

.code-output {
    background: #1a1a1a;
    border-radius: 8px;
    padding: 14px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 11px;
    color: #aaa;
    margin-top: 20px;
    max-height: 250px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.color-picker-panel {
    position: absolute;
    top: 20px;
    right: -380px;
    bottom: 20px;
    width: 340px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(80px) saturate(150%);
    -webkit-backdrop-filter: blur(80px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: right 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.3s ease;
    z-index: 100;
    opacity: 0;
}

.color-picker-panel.open {
    right: 20px;
    opacity: 1;
    transition: right 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) 0.25s, opacity 0.3s ease 0.25s;
}

#controls {
    transition: right 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) 0.25s, bottom 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) 0.25s, opacity 0.3s ease 0.25s;
    width: 340px;
    opacity: 1;
}

#controls.picker-open {
    right: 380px;
    transition: right 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), bottom 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.3s ease;
}

#controls.returning-from-picker {
    transition: right 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), bottom 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.3s ease;
}

#controls.hidden {
    right: -340px;
    opacity: 0;
    transition: right 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), bottom 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.3s ease;
}

.controls-hide-btn {
    position: fixed;
    right: 368px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(80px) saturate(150%);
    -webkit-backdrop-filter: blur(80px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    transition: right 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.3s ease;
}

.controls-hide-btn span {
    display: block;
    width: 10px;
    height: 10px;
    border-right: 2.5px solid rgba(255,255,255,0.7);
    border-top: 2.5px solid rgba(255,255,255,0.7);
    border-radius: 2px;
    transform: rotate(45deg);
    margin-left: -3px;
}

.controls-hide-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.controls-hide-btn:hover span {
    border-color: #fff;
}

#controls.hidden ~ .controls-hide-btn {
    opacity: 0;
    pointer-events: none;
}

.controls-hide-btn.fade-only {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease !important;
}

#controls.picker-open ~ .controls-hide-btn {
    right: 728px;
    transition: right 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.controls-show-btn {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(80px) saturate(150%);
    -webkit-backdrop-filter: blur(80px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 50;
}

.controls-show-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.3s ease 0.25s;
}

.controls-show-btn span {
    display: block;
    width: 10px;
    height: 10px;
    border-left: 2.5px solid rgba(255,255,255,0.7);
    border-bottom: 2.5px solid rgba(255,255,255,0.7);
    border-radius: 2px;
    transform: rotate(45deg);
    margin-right: -2px;
}

.controls-show-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.controls-show-btn:hover span {
    border-color: #fff;
}

.picker-inner {
    padding: 20px 20px 24px 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.picker-original {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex: 0 0 36px;
}

.picker-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    flex: 1;
}

.picker-close {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(80px) saturate(150%);
    -webkit-backdrop-filter: blur(80px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 20px;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex: 0 0 36px;
}

.picker-close:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
    transform: none;
}

.picker-gradient {
    flex: 1;
    border-radius: 12px;
    position: relative;
    cursor: crosshair;
    background: linear-gradient(to bottom, transparent, #000),
                linear-gradient(to right, #fff, hsl(0, 100%, 50%));
}

.picker-cursor {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.picker-hue-row {
    height: 46px;
}

.picker-hue {
    width: 100%;
    height: 46px;
    border-radius: 12px;
    position: relative;
    cursor: crosshair;
    background: linear-gradient(to right,
        hsl(0, 100%, 50%),
        hsl(60, 100%, 50%),
        hsl(120, 100%, 50%),
        hsl(180, 100%, 50%),
        hsl(240, 100%, 50%),
        hsl(300, 100%, 50%),
        hsl(360, 100%, 50%));
}

.picker-hue-cursor {
    position: absolute;
    top: 50%;
    width: 8px;
    height: 32px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.picker-hex-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    overflow: hidden;
}

.picker-label {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.picker-hex-input {
    flex: 1;
    min-width: 0;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    font-family: 'SF Mono', Monaco, monospace;
    color: #fff;
    outline: none;
    box-sizing: border-box;
}

.picker-hex-input:focus {
    border-color: rgba(255,255,255,0.4);
}

.picker-new-color {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex: 0 0 36px;
    background: #FF8C33;
}

/* Mobile & tablet portrait responsive */
@media (max-width: 768px), (max-width: 1024px) and (orientation: portrait) {
    body {
        overflow: hidden;
    }

    #controls {
        position: fixed;
        top: auto;
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: auto;
        height: 50vh;
        max-height: 50vh;
        border-radius: 20px;
        transition: bottom 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) 0.25s, opacity 0.35s ease 0.25s;
    }

    #controls-inner {
        width: 100%;
        max-height: 50vh;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 16px;
        -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
        mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
    }

    #controls.picker-open {
        right: 12px;
        bottom: -55vh;
        opacity: 0;
        transition: bottom 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.35s ease;
    }

    .settings-container {
        margin-bottom: 12px;
    }

    .slider-row {
        margin-bottom: 16px;
    }

    .button-row {
        margin-top: 16px;
    }

    .color-picker-panel {
        position: fixed;
        top: auto;
        right: 12px;
        left: 12px;
        bottom: -55vh;
        width: auto;
        height: 50vh;
        max-height: 50vh;
        opacity: 0;
        transition: bottom 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.35s ease;
    }

    .color-picker-panel.open {
        right: 12px;
        bottom: 12px;
        opacity: 1;
        transition: bottom 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) 0.25s, opacity 0.35s ease 0.25s;
    }

    .picker-gradient {
        min-height: 150px;
    }

    #controls {
        width: auto;
    }

    .controls-hide-btn {
        right: auto;
        left: 50%;
        top: auto;
        bottom: calc(50vh + 24px);
        transform: translateX(-50%);
    }

    .controls-hide-btn span {
        border-right: none;
        border-top: none;
        border-left: 2.5px solid rgba(255,255,255,0.7);
        border-bottom: 2.5px solid rgba(255,255,255,0.7);
        transform: rotate(-45deg);
        margin-left: 0;
        margin-top: -2px;
    }

    #controls.hidden ~ .controls-hide-btn {
        bottom: -50px;
    }

    #controls.hidden {
        bottom: -420px;
        right: 12px;
    }

    .controls-show-btn {
        right: 50%;
        left: auto;
        top: auto;
        bottom: 20px;
        transform: translateX(50%);
        opacity: 0;
        pointer-events: none;
    }

    .controls-show-btn span {
        border-right: none;
        border-top: none;
        border-left: 2px solid rgba(255,255,255,0.7);
        border-bottom: 2px solid rgba(255,255,255,0.7);
        transform: rotate(135deg);
        margin-left: 0;
        margin-top: 2px;
    }

    .controls-show-btn.visible {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Authentication UI */
.auth-container {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 100;
}

.signin-wrapper {
    position: relative;
    width: 32px;
    height: 32px;
}

.signin-wrapper.hidden {
    display: none;
}

.google-signin-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    cursor: pointer;
}

.google-signin-overlay iframe {
    cursor: pointer !important;
}

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.auth-btn:hover {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.1);
}

.user-menu {
    display: none;
    align-items: center;
    gap: 6px;
}

.user-menu.active {
    display: flex;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
