:root {
    --bg-color: #0f0c29;
    --bg-gradient: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary-color: #00d2ff;
    --primary-gradient: linear-gradient(to right, #00d2ff, #3a7bd5);
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --card-radius: 20px;
    --input-bg: rgba(0, 0, 0, 0.2);
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --font-heading: 'Outfit', sans-serif;
    --transition-speed: 0.3s;
}

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

body {
    font-family: var(--font-heading);
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Background Blobs for Atmosphere */
.background-blobs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 10s infinite ease-in-out alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #FF0099; 
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: #493240; 
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: #00d2ff; 
    top: 40%;
    left: 40%;
    opacity: 0.4;
    animation-duration: 15s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 50px) scale(1.1); }
}

/* Main Container */
.app-container {
    position: relative;
    z-index: 10;
    width: 90%;
    max-width: 500px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--card-radius);
    padding: 2rem;
    box-shadow: var(--shadow-main);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo ion-icon {
    font-size: 1.8rem;
    color: #00d2ff; /* Fallback */
    -webkit-text-fill-color: #00d2ff;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-speed);
    padding: 0.5rem;
    border-radius: 50%;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.1);
    transform: rotate(45deg);
}

.icon-btn-sm {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.3rem;
    cursor: pointer;
    transition: var(--transition-speed);
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn-sm:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* Text Input */
.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding: 0 0.2rem;
}

.input-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.preset-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 210, 255, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    border: 1px solid rgba(0, 210, 255, 0.2);
    transition: var(--transition-speed);
    cursor: pointer;
    position: relative;
    max-width: 200px;
}

.preset-wrapper:hover {
    background: rgba(0, 210, 255, 0.2);
    border-color: var(--primary-color);
}

.preset-wrapper ion-icon:first-child {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.select-arrow {
    font-size: 0.8rem;
    color: var(--text-muted);
    pointer-events: none;
}

.styled-select-sm {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.styled-select-sm option {
    background: #1a1a2e;
    color: var(--text-main);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Gap handles spacing between wrapper and textarea now that wrapper is inside */
    position: relative;
}

textarea {
    width: 100%;
    height: 150px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1.1rem;
    resize: none;
    outline: none;
    transition: var(--transition-speed);
}

textarea:focus {
    border-color: var(--primary-color);
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.1);
}

textarea::placeholder {
    color: rgba(255,255,255,0.4);
}

.char-count {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
}

.primary-btn {
    position: relative;
    background: var(--primary-gradient);
    border: none;
    padding: 0.8rem 2.5rem;
    border-radius: 30px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-speed);
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.4);
    overflow: hidden;
}

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

.primary-btn:active {
    transform: translateY(0);
}

.primary-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Audio Player */
.audio-wrapper.hidden {
    display: none;
}

.audio-wrapper {
    margin-top: 1rem;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.audio-player-ui {
    background: rgba(0,0,0,0.3);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--glass-border);
}

.play-btn {
    background: var(--text-main);
    color: #0f0c29;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-speed);
}

.play-btn:hover {
    transform: scale(1.1);
}

.waveform-visualizer {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 20px;
}

.bar {
    width: 4px;
    background: var(--primary-color);
    border-radius: 2px;
    height: 20%;
    animation: pulse 1s infinite ease-in-out;
}

.waveform-visualizer.playing .bar {
    animation-duration: 0.5s;
}

.bar:nth-child(even) { animation-delay: 0.2s; }
.bar:nth-child(3n) { animation-delay: 0.4s; }

@keyframes pulse {
    0% { height: 20%; opacity: 0.5; }
    50% { height: 100%; opacity: 1; }
    100% { height: 20%; opacity: 0.5; }
}

.visualizer-idle .bar {
    height: 3px;
    animation: none;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal.hidden {
    pointer-events: none;
    opacity: 0;
}

.modal-content {
    width: 90%;
    max-width: 450px;
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-main);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h2 {
    font-size: 1.4rem;
}

/* Tabs */
.tabs-nav {
    display: flex;
    gap: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-speed);
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--primary-color);
    background: rgba(0, 210, 255, 0.1);
    font-weight: 500;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* Settings Groups (Reused) */
.settings-section-title {
    display: none; /* Hidden now that we have tabs */
}

.divider {
    display: none; /* Hidden now that we have tabs */
}

.form-group {
    margin-bottom: 1rem;
}

/* Sliders */
.slider-group {
    margin-bottom: 1.2rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.slider-value {
    color: var(--primary-color);
    font-weight: 600;
}

input[type=range] {
    width: 100%;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    border: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    margin-top: -6px;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
    transition: transform 0.2s;
}

input[type=range]:hover::-webkit-slider-thumb {
    transform: scale(1.2);
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 1rem;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.checkbox-group input[type="checkbox"]:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-group input[type="checkbox"]:checked::after {
    content: '✔';
    font-size: 0.8rem;
    color: #fff;
    font-weight: bold;
}

.checkbox-group label {
    margin: 0;
    font-size: 0.95rem;
    cursor: pointer;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0 0.8rem;
}

.input-wrapper ion-icon {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.input-wrapper input,
.input-wrapper select {
    flex: 1;
    background: none;
    border: none;
    padding: 0.8rem;
    color: var(--text-main);
    outline: none;
    font-family: inherit;
}

.styled-select {
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Custom dropdown arrow for select */
.input-wrapper:has(select)::after {
    content: '▼';
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-right: 10px;
    pointer-events: none;
}

.styled-select option {
    background: #1a1a2e;
    color: var(--text-main);
}

.hint {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.3rem;
    font-style: italic;
}

.secondary-btn {
    width: 100%;
    padding: 0.8rem;
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-speed);
}

.secondary-btn:hover {
    background: var(--primary-color);
    color: #fff;
}

.sml-icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

/* Loader */
.loader {
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top: 3px solid #fff;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: none;
}

.loader.active {
    display: block;
}

.btn-icon.hidden {
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utility for hidden elements */
.hidden {
    display: none !important;
}
