/* CSS Reset and Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 100%);
    color: rgba(255, 255, 255, 0.8);
}

/* Main Container */
.container {
    max-width: 480px;
    width: 100%;
    padding: 20px;
}

/* Glassmorphism Card */
.card {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 32px;

    /* Gradient outline effect using pseudo-element */
    border: 2px solid transparent;
    background-clip: padding-box;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    padding: 2px;
    background: linear-gradient(135deg, #00d4ff 0%, #ff00d4 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Fallback for browsers without backdrop-filter support */
@supports not (backdrop-filter: blur(10px)) {
    .card {
        background: rgba(26, 26, 46, 0.85);
    }
}

/* Typography */
header h1 {
    margin: 0 0 32px 0;
    font-size: 2rem;
    font-weight: 600;
    color: #ffffff;
    text-align: center;
}

.section-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

/* Control Sections */
.control-section {
    margin-bottom: 24px;
}

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

/* ===== Custom Select Dropdown ===== */
.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.12) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 14px 18px;
    padding-right: 44px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
}

.custom-select-trigger:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.18) 100%);
    border-color: rgba(255, 255, 255, 0.45);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.custom-select-trigger:focus {
    outline: none;
}

.custom-select.open .custom-select-trigger {
    border-color: transparent;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.3), 0 0 0 4px rgba(255, 0, 212, 0.2);
    border-radius: 8px 8px 0 0;
}

/* Arrow */
.custom-select::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    width: 14px;
    height: 9px;
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='9' viewBox='0 0 14 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L7 7L13 1' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    transition: transform 0.2s ease;
    z-index: 2;
}

.custom-select.open::after {
    transform: translateY(-50%) rotate(180deg);
}

/* Options Panel */
.custom-select-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.custom-select.open .custom-select-options {
    display: block;
}

.custom-select.open.visible .custom-select-options {
    opacity: 1;
    transform: translateY(0);
}

.custom-select-option {
    padding: 12px 18px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    font-size: 1rem;
}

.custom-select-option:hover,
.custom-select-option.focused {
    background: rgba(0, 212, 255, 0.15);
    color: white;
}

.custom-select-option.selected {
    color: #00d4ff;
}

.custom-select-option:last-child {
    border-radius: 0 0 7px 7px;
}

/* ===== Number Inputs ===== */
.control-section input[type="number"] {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    color: white;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    appearance: textfield;
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
}

.control-section input[type="number"]::-webkit-inner-spin-button,
.control-section input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.control-section input[type="number"]:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

/* Custom Sample Rate Input */
#customSampleRate {
    margin-top: 8px;
}

/* ===== Time Field Container ===== */
.time-field {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* Time Labels */
.time-label {
    font-size: 0.625rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Time Inputs Container */
.time-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-inputs input {
    width: 60px;
    text-align: center;
    cursor: pointer;
}

.time-inputs input:hover {
    background: rgba(255, 255, 255, 0.15);
}

.time-inputs .separator {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.25rem;
    padding: 0 2px;
}

/* Time field with active picker */
.time-field.picker-active input {
    border-color: #00d4ff;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
    background: rgba(0, 212, 255, 0.05);
}

/* ===== Inline Scroll Picker ===== */
.inline-picker {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    width: 72px;
    height: 160px;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    margin-top: 4px;
}

.inline-picker.visible {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Gradient border effect */
.inline-picker::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 12px;
    padding: 1px;
    background: linear-gradient(135deg, #00d4ff 0%, #ff00d4 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 3;
}

/* Fade edges */
.inline-picker::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(26, 26, 46, 0.95) 0%,
        transparent 25%,
        transparent 75%,
        rgba(26, 26, 46, 0.95) 100%
    );
    pointer-events: none;
    border-radius: 12px;
    z-index: 2;
}

/* Viewport with scroll */
.inline-picker-viewport {
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-y;
    position: relative;
    z-index: 1;
}

.inline-picker-viewport::-webkit-scrollbar {
    display: none;
}

.inline-picker-viewport:focus {
    outline: none;
}

/* Track containing all values */
.inline-picker-track {
    padding: 60px 0;
}

/* Individual value items */
.inline-picker-item {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.35);
    scroll-snap-align: center;
    transition: color 0.15s, transform 0.15s;
    cursor: pointer;
}

.inline-picker-item.selected {
    color: white;
    transform: scale(1.1);
}

/* Center highlight bar */
.inline-picker-highlight {
    position: absolute;
    top: 50%;
    left: 6px;
    right: 6px;
    height: 40px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    pointer-events: none;
    z-index: 1;
}

/* ===== Generate Button ===== */
.btn-generate {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #00d4ff 0%, #ff00d4 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-generate:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
}

.btn-generate:active {
    transform: scale(0.98);
}

.btn-generate:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.3);
}
