/* ==============================================
   Freya TTS - Emotional Text-to-Speech Styles
   ============================================== */

body {
    background: rgb(19, 24, 38);
    background-attachment: fixed;
    font-family: 'DM Sans', sans-serif;
}

/* ==============================================
   Custom Scrollbar (Webkit)
   ============================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) rgba(255, 255, 255, 0.02);
}

/* ==============================================
   Navigation Header
   ============================================== */

.nav-header {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-link {
    display: block;
    transition: all 0.3s ease;
    border-radius: 8px;
    overflow: hidden;
}

.logo-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.3);
}

.logo-image {
    height: 48px;
    width: auto;
    display: block;
}

.product-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 100px;
}

.badge-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
}

.badge-name {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.beta-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(251, 191, 36, 1);
    background: rgba(251, 191, 36, 0.15);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

/* ==============================================
   Hero Section
   ============================================== */

.hero-section {
    text-align: center;
    padding: 24px 0 40px;
    max-width: 800px;
    margin: 0 auto;
}

.hero-badges {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(96, 165, 250, 1);
}

.hero-badge-beta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(251, 191, 36, 1);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 56px;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 18px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.6);
    max-width: 600px;
    margin: 0 auto;
}

/* ==============================================
   Glass Card
   ============================================== */

.glass-card {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ==============================================
   Emotion Chips (in text input)
   ============================================== */

.emotion-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    margin: 0 3px;
    cursor: move;
    vertical-align: middle;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
    z-index: 10;
    border: 1.5px solid currentColor;
    letter-spacing: 0.01em;
}

.emotion-chip:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 16px -2px currentColor;
    z-index: 300;
}

.emotion-chip .remove {
    margin-left: 4px;
    opacity: 0.6;
    cursor: pointer;
    position: relative;
    z-index: 400; /* Higher than intensity selector (350) to always be clickable */
    pointer-events: all;
}

.emotion-chip .remove:hover {
    opacity: 1;
    transform: scale(1.2);
}

.emotion-chip.dragging {
    opacity: 0.3;
}

/* Hide intensity selector while dragging to prevent visual clutter and blocking */
.emotion-chip.dragging .chip-intensity-selector {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.emotion-chip[class*="emotion-"] {
    background: currentColor;
    opacity: 0.9;
}

/* ==============================================
   Emotion Categories (sidebar)
   ============================================== */

.emotion-category {
    margin-bottom: 20px;
}

.emotion-category-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 10px;
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    background: rgba(255, 255, 255, 0.02);
}

.emotion-category-title:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.65);
}

.emotion-category-title::after {
    content: '▼';
    font-size: 9px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.5;
}

.emotion-category.collapsed .emotion-category-title::after {
    transform: rotate(-90deg);
}

.emotion-category-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
}

.emotion-category.collapsed .emotion-category-content {
    max-height: 0;
    opacity: 0;
}

/* ==============================================
   Emotion Pills (sidebar palette)
   ============================================== */

.emotion-pill {
    padding: 12px 14px;
    border-radius: 12px;
    cursor: grab;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    border: 1.5px solid transparent;
    position: relative;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
}

.emotion-pill:hover {
    transform: translateY(-2px);
    border-color: currentColor;
    box-shadow: 0 6px 20px -4px currentColor;
    background: rgba(255, 255, 255, 0.04);
}

.emotion-pill:active {
    cursor: grabbing;
    transform: scale(0.96);
}

.emotion-pill.dragging {
    opacity: 0.4;
    cursor: grabbing;
}

/* ==============================================
   Intensity Selector (on inserted chips)
   ============================================== */

.chip-intensity-selector {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(-8px);
    display: flex;
    gap: 3px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 350; /* Higher than hovered chip to appear above everything */
    padding-left: 8px;
    margin-left: -8px;
}

.chip-intensity-selector::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 0;
    bottom: 0;
    width: 12px;
    pointer-events: all;
}

.emotion-chip:hover .chip-intensity-selector {
    opacity: 1;
    pointer-events: all;
    transform: translateY(-50%) translateX(4px);
}

.chip-intensity-selector:hover {
    opacity: 1;
    pointer-events: all;
}

.chip-intensity-badge:nth-child(1) { transition-delay: 0s; }
.chip-intensity-badge:nth-child(2) { transition-delay: 0.03s; }
.chip-intensity-badge:nth-child(3) { transition-delay: 0.06s; }
.chip-intensity-badge:nth-child(4) { transition-delay: 0.09s; }

.chip-intensity-badge {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(10, 14, 39, 0.95);
    border: 1px solid currentColor;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.chip-intensity-badge:hover {
    background: rgba(10, 14, 39, 0.95);
    color: white;
    transform: scale(1.2);
    border-color: currentColor;
    border-width: 2px;
    box-shadow: 0 0 0 1px currentColor, 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 16px currentColor;
}

.chip-intensity-badge:active {
    transform: scale(0.9);
}

.chip-intensity-badge.active {
    background: rgba(10, 14, 39, 0.95) !important;
    color: white !important;
    font-weight: 900;
    border-color: currentColor !important;
    border-width: 2px;
    box-shadow: 0 0 0 2px currentColor, 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 12px currentColor;
}

/* ==============================================
   Drag & Drop Caret
   ============================================== */

.drop-caret {
    position: absolute;
    width: 3px;
    height: 24px;
    background: linear-gradient(to bottom, #0080FF, #FF006E);
    border-radius: 1.5px;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 0 10px rgba(0, 128, 255, 0.5),
                0 0 20px rgba(255, 0, 110, 0.3);
    animation: caretBlink 1s ease-in-out infinite;
    display: none;
}

.drop-caret.active {
    display: block;
}

.drop-caret::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #0080FF;
}

.drop-caret::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 6px solid #FF006E;
}

@keyframes caretBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.3; }
}

/* ==============================================
   Drag Preview
   ============================================== */

.drag-preview {
    position: fixed;
    top: -1000px;
    left: -1000px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3),
                0 0 0 2px rgba(255, 255, 255, 0.2);
    pointer-events: none;
    z-index: 10000;
    transform: scale(0.85);
    opacity: 0.95;
}

.drag-preview .emoji {
    font-size: 18px;
}

.drag-preview .label {
    font-size: 13px;
    font-weight: 600;
}

/* ==============================================
   Emotion Zones - Colored Text
   ============================================== */

.emotion-zone {
    display: inline;
    position: relative;
    padding: 0;
    margin: 0;
    /* Text color will be set inline per emotion */
    /* Smooth transitions for hover effects */
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.emotion-zone:hover {
    /* Slightly brighten on hover for interactivity */
    filter: brightness(1.15);
}

/* ==============================================
   Text Input
   ============================================== */

#textInput {
    min-height: 220px;
    line-height: 1.9;
    padding: 20px;
    font-size: 16px;
    /* Default text color: Neutral grey (no emotion = grey) */
    color: #d1d5db;
}

#textInput:empty:before {
    content: attr(placeholder);
    /* Placeholder: Even more muted grey */
    color: rgba(209, 213, 219, 0.4);
    pointer-events: none;
}

#textInput.drag-over {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ==============================================
   Buttons & Controls
   ============================================== */

button {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

button:active {
    transform: scale(0.97);
}

.generate-button {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    font-weight: 600;
    font-size: 15px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 24px -6px rgba(59, 130, 246, 0.5);
    position: relative;
    overflow: hidden;
}

.generate-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.generate-button:hover::before {
    opacity: 1;
}

.generate-button:hover {
    box-shadow: 0 12px 32px -6px rgba(59, 130, 246, 0.6);
    transform: translateY(-2px);
}

.generate-button:active {
    transform: translateY(0) scale(0.98);
}

.generate-button svg,
.generate-button span {
    position: relative;
    z-index: 1;
}

.glass-card h3 {
    font-size: 16px;
    letter-spacing: -0.01em;
}

/* ==============================================
   Responsive Design
   ============================================== */

@media (max-width: 1024px) {
    .hero-title {
        font-size: 42px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    .logo-image {
        height: 40px;
    }
}

@media (max-width: 768px) {
    .hero-section {
        padding: 16px 0 24px;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 15px;
    }
    
    .product-badge {
        padding: 6px 12px;
    }
    
    .badge-label {
        display: none;
    }
    
    .beta-badge {
        font-size: 9px;
        padding: 2px 6px;
    }
    
    .footer-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .footer-badge {
        font-size: 12px;
    }
}

/* ==============================================
   Audio Player Enhancements
   ============================================== */

#audioPlayerSection .grid > div {
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.2s ease;
}

#audioPlayerSection .grid > div:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

#playPauseBtn {
    position: relative;
}

#playPauseBtn::before {
    content: '';
    position: absolute;
    inset: -4px;
    background: inherit;
    border-radius: inherit;
    filter: blur(12px);
    opacity: 0.6;
    z-index: -1;
}

/* ==============================================
   Toast Notifications
   ============================================== */

.toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    padding: 18px 28px;
    border-radius: 14px;
    backdrop-filter: blur(24px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: none;
    animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 480px;
    font-weight: 500;
    font-size: 15px;
}

.toast.success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(22, 163, 74, 0.95));
    border: 1px solid rgba(74, 222, 128, 0.3);
    box-shadow: 0 16px 48px rgba(34, 197, 94, 0.4);
}

.toast.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.95));
    border: 1px solid rgba(248, 113, 113, 0.3);
    box-shadow: 0 16px 48px rgba(239, 68, 68, 0.4);
}

.toast.show {
    display: block;
}

/* ==============================================
   Footer
   ============================================== */

.footer {
    margin-top: 80px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(15, 23, 42, 0.4);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.footer-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
}

.footer-link {
    color: rgba(139, 92, 246, 0.9);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.footer-link:hover {
    color: rgba(167, 139, 250, 1);
    text-decoration: underline;
}

.footer-copyright {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.3);
}

.footer-right {
    display: flex;
    align-items: center;
}

.footer-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 100px;
    font-size: 13px;
    color: rgba(74, 222, 128, 0.9);
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: rgba(74, 222, 128, 1);
    border-radius: 50%;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ==============================================
   Animations
   ============================================== */

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

@keyframes pop-in {
    0% {
        transform: scale(0.95);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* ==============================================
   Integrated Audio Player
   ============================================== */

#playPauseBtn {
    transition: all 0.2s ease;
}

#playPauseBtn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

#playPauseBtn:active {
    transform: scale(0.95);
}

#progressBar {
    pointer-events: none; /* Let clicks go through to parent */
    /* Smooth animation: 350ms linear for fluid motion (updates every 100ms) */
    transition: width 0.35s linear !important;
    /* Will-change optimizes GPU acceleration for smoother animation */
    will-change: width;
}

#progressBarContainer[style*="cursor: pointer"]:hover #progressBar {
    filter: brightness(1.2); /* Brighten on hover when seeking is enabled */
}

#progressBarContainer[style*="cursor: pointer"]:active #progressBar {
    filter: brightness(1.4); /* Extra bright on click */
}

#downloadBtn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
}

#downloadBtn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* ============================================
   Welcome Modal Styles
   ============================================ */
#welcomeModal {
    animation: fadeIn 0.3s ease-out;
}

#welcomeModal.hidden {
    display: none;
}

#welcomeModal > div {
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Smooth fade out animation when closing */
#welcomeModal.fade-out {
    animation: fadeOut 0.2s ease-out forwards;
}

#welcomeModal.fade-out > div {
    animation: slideDown 0.2s ease-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

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