/* CSS Variables */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-color: #667eea;
    --accent-hover: #764ba2;
    --error-color: #ff4757;
    --success-color: #2ed573;
    --border-radius: 16px;
    --transition: all 0.3s ease;
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
}

body {
    background: 
        radial-gradient(ellipse at top, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
        var(--bg-primary);
    min-height: 100vh;
}

/* Screens */
.screen {
    min-height: 100vh;
    padding: 20px;
}

.screen.hidden {
    display: none;
}

/* Login Screen */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.logo {
    margin-bottom: 30px;
}

.logo-circle {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--accent-gradient);
    box-shadow: 0 0 40px rgba(102, 126, 234, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 40px rgba(102, 126, 234, 0.5); }
    50% { transform: scale(1.05); box-shadow: 0 0 60px rgba(102, 126, 234, 0.7); }
}

.logo h1 {
    font-size: 2rem;
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#password-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 1rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

#password-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

#password-input::placeholder {
    color: var(--text-secondary);
}

#login-btn, .send-button {
    width: 100%;
    padding: 16px 24px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--border-radius);
    color: white;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

#login-btn:hover, .send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

#login-btn:active, .send-button:active {
    transform: translateY(0);
}

#login-btn.loading, .send-button.loading {
    pointer-events: none;
}

#login-btn.loading .btn-text, .send-button.loading .btn-text {
    opacity: 0;
}

#login-btn.loading .btn-loader, .send-button.loading .btn-loader {
    display: block;
}

.btn-loader {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.error-message {
    color: var(--error-color);
    font-size: 0.9rem;
    margin-top: 10px;
    min-height: 20px;
}

/* Control Screen */
#control-screen {
    max-width: 480px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.icon-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--accent-color);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

/* Control Sections */
.control-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.control-section h2 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

/* Color Picker */
.color-picker-container {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 0 auto 20px;
}

#color-wheel {
    border-radius: 50%;
    cursor: crosshair;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.2);
}

#color-selector {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    transform: translate(-50%, -50%);
    top: 50%;
    left: 50%;
}

.color-preview-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.color-preview {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

#rgb-value {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Sliders */
.slider-container {
    padding: 10px 0;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #1a1a24, #ffffff);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.cct-slider input[type="range"] {
    background: linear-gradient(to right, #ff9500, #ffffff, #87ceeb);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 28px;
    height: 28px;
    background: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.slider-labels span:nth-child(2) {
    font-weight: 600;
    color: var(--text-primary);
}

/* Send Button Section */
.control-section:last-of-type {
    background: transparent;
    border: none;
    padding: 0;
}

.send-note {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 12px;
}

/* Status Message */
.status-message {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 24px;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    max-width: calc(100% - 40px);
    text-align: center;
    z-index: 100;
}

.status-message.show {
    opacity: 1;
    visibility: visible;
}

.status-message.success {
    background: rgba(46, 213, 115, 0.15);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.status-message.error {
    background: rgba(255, 71, 87, 0.15);
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .screen {
        padding: 16px;
    }
    
    .color-picker-container {
        width: 240px;
        height: 240px;
    }
    
    #color-wheel {
        width: 240px;
        height: 240px;
    }
    
    .control-section {
        padding: 20px;
    }
}

/* Disable text selection on interactive elements */
#color-wheel, input[type="range"], button {
    -webkit-user-select: none;
    user-select: none;
}
