/**
 * Audigeny - Custom Styles
 * Additional styles for components not easily achievable with Tailwind
 */

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

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

/* Selection */
::selection {
    background: rgba(139, 92, 246, 0.5);
    color: white;
}

/* Hide Scrollbar Utility */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Force Text Truncation on Mobile */
@media (max-width: 767px) {
    .truncate {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    
    .card {
        overflow: hidden !important;
    }
    
    .card.\!overflow-visible {
        overflow: visible !important;
    }
}

/* Create Page - Genre & Mood Grid Fix for Mobile */
.genre-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
}

.genre-item {
    display: block !important;
    cursor: pointer;
}

.mood-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
}

.mood-item {
    display: inline-block !important;
    cursor: pointer;
}

/* Ensure inline styles work on all devices */
@media (max-width: 1024px) {
    .genre-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Animations */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(139, 92, 246, 0.6);
    }
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes spin-slow {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse-ring {
    0%, 100% {
        transform: scale(1);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.6;
    }
}

@keyframes spin-reverse {
    from {
        transform: rotate(360deg);
    }
    to {
        transform: rotate(0deg);
    }
}

@keyframes bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

.animate-slide-up {
    animation: slide-up 0.5s ease-out;
}

.animate-fade-in {
    animation: fade-in 0.3s ease-out;
}

.animate-spin-slow {
    animation: spin-slow 20s linear infinite;
}

.animate-spin-medium {
    animation: spin-slow 12s linear infinite;
}

.animate-spin-fast {
    animation: spin-slow 8s linear infinite;
}

.animate-spin-slow-reverse {
    animation: spin-reverse 18s linear infinite;
}

.animate-pulse-ring {
    animation: pulse-ring 2s ease-in-out infinite;
}

.animate-bounce-in {
    animation: bounce-in 0.5s ease-out;
}

/* Audio Player Waveform */
.waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 40px;
}

.waveform-bar {
    width: 3px;
    background: linear-gradient(to top, #8B5CF6, #EC4899);
    border-radius: 3px;
    animation: waveform-animation 1s ease-in-out infinite;
}

@keyframes waveform-animation {
    0%, 100% {
        height: 20%;
    }
    50% {
        height: 100%;
    }
}

.waveform-bar:nth-child(1) { animation-delay: 0s; }
.waveform-bar:nth-child(2) { animation-delay: 0.1s; }
.waveform-bar:nth-child(3) { animation-delay: 0.2s; }
.waveform-bar:nth-child(4) { animation-delay: 0.3s; }
.waveform-bar:nth-child(5) { animation-delay: 0.4s; }

/* Song Card Hover Effects */
.song-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.song-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.song-card .play-overlay {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.song-card:hover .play-overlay {
    opacity: 1;
}

/* Genre Badge Styles */
.genre-badge {
    position: relative;
    overflow: hidden;
}

.genre-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.genre-badge:hover::before {
    left: 100%;
}

/* Input Focus Styles */
input:focus, 
textarea:focus, 
select:focus {
    outline: none;
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* Button Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease;
}

.btn-ripple:active::after {
    width: 200px;
    height: 200px;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.05) 25%, 
        rgba(255, 255, 255, 0.1) 50%, 
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Notification Badge */
.notification-badge {
    position: relative;
}

.notification-badge::after {
    content: attr(data-count);
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: bold;
    line-height: 18px;
    text-align: center;
    color: white;
    background: #EC4899;
    border-radius: 9px;
}

/* Modal Backdrop Blur */
.modal-backdrop {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Gradient Text Animation */
.text-gradient-animated {
    background: linear-gradient(90deg, #8B5CF6, #EC4899, #8B5CF6);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Progress Bar */
.progress-bar {
    position: relative;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar .progress {
    height: 100%;
    background: linear-gradient(90deg, #8B5CF6, #EC4899);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Audio Visualizer */
.audio-visualizer {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    height: 60px;
}

.audio-visualizer .bar {
    width: 4px;
    background: linear-gradient(to top, #8B5CF6, #EC4899);
    border-radius: 2px;
    transition: height 0.1s ease;
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
    color: white;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Range Slider */
input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -6px;
    background: linear-gradient(135deg, #8B5CF6, #EC4899);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Mobile Touch Optimization */
@media (max-width: 768px) {
    .touch-target {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ============================================
   COMPREHENSIVE MOBILE RESPONSIVE STYLES
   ============================================ */

/* Base Mobile Fixes */
@media (max-width: 768px) {
    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    
    /* Container padding */
    .container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    
    /* Typography adjustments */
    h1 {
        font-size: 1.875rem !important;
        line-height: 1.2 !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    /* Button improvements */
    .btn-primary, .btn-secondary {
        padding: 12px 20px !important;
        font-size: 0.9375rem !important;
        width: 100%;
        justify-content: center;
    }
    
    /* Card improvements */
    .card {
        border-radius: 1rem !important;
    }
    
    /* Input fields */
    input, textarea, select {
        font-size: 16px !important; /* Prevents iOS zoom */
        padding: 14px 16px !important;
    }
    
    /* Table responsive */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Navigation Mobile Improvements */
@media (max-width: 768px) {
    nav .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    
    /* Logo size */
    nav .text-xl {
        font-size: 1rem !important;
    }
    
    nav .w-10.h-10 {
        width: 36px !important;
        height: 36px !important;
    }
}

/* Hero Section Mobile */
@media (max-width: 768px) {
    section.min-h-\[90vh\] {
        min-height: auto !important;
        padding-top: 80px !important;
        padding-bottom: 60px !important;
    }
    
    /* Hero heading */
    .text-7xl, .text-6xl {
        font-size: 2rem !important;
    }
    
    /* Hero description */
    .text-xl.text-gray-400 {
        font-size: 1rem !important;
    }
    
    /* Stats grid */
    .grid-cols-3 .text-3xl {
        font-size: 1.25rem !important;
    }
    
    .grid-cols-3 .text-sm {
        font-size: 0.75rem !important;
    }
}

/* Song Cards Mobile */
@media (max-width: 768px) {
    .song-card {
        transform: none !important;
    }
    
    .song-card:hover {
        transform: none !important;
    }
    
    /* Grid adjustments */
    .grid-cols-2.md\:grid-cols-4,
    .grid-cols-1.md\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    .grid-cols-1.md\:grid-cols-3 {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

/* Very small screens */
@media (max-width: 380px) {
    .grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
}

/* Global Player Mobile */
@media (max-width: 768px) {
    #globalPlayer {
        padding-bottom: env(safe-area-inset-bottom) !important;
    }
    
    #globalPlayer .container {
        padding: 0 12px !important;
    }
    
    #globalPlayer .h-20 {
        height: auto !important;
        min-height: 70px !important;
        padding: 8px 0 !important;
        flex-wrap: wrap !important;
    }
    
    /* Song info */
    #globalPlayer .w-1\/4:first-child {
        width: auto !important;
        flex: 0 0 auto !important;
    }
    
    #globalPlayer .w-14 {
        width: 44px !important;
        height: 44px !important;
    }
    
    /* Player controls */
    #globalPlayer .w-2\/4 {
        width: 100% !important;
        order: 3 !important;
        margin-top: 8px !important;
    }
    
    #globalPlayer .space-x-6 {
        gap: 24px !important;
    }
    
    /* Volume controls */
    #globalPlayer .w-1\/4:last-child {
        width: auto !important;
        flex: 1 !important;
        justify-content: flex-end !important;
    }
    
    /* Progress bar */
    #globalPlayer .max-w-md {
        max-width: 100% !important;
    }
}

/* Create Page Mobile */
@media (max-width: 768px) {
    /* Form layout - sidebar below main form */
    .lg\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }
    
    .lg\:col-span-2 {
        grid-column: span 1 !important;
    }
    
    /* Page header */
    .text-center.mb-12 {
        margin-bottom: 1.5rem !important;
    }
    
    .text-center.mb-12 h1 {
        font-size: 1.5rem !important;
    }
    
    .text-center.mb-12 p {
        font-size: 0.875rem !important;
    }
    
    /* Cards padding */
    .card.p-6 {
        padding: 1rem !important;
    }
    
    /* Labels */
    .card .text-lg.font-semibold {
        font-size: 1rem !important;
    }
    
    /* Genre grid - 2 columns on mobile */
    .grid.grid-cols-3.md\:grid-cols-5 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }
    
    /* Genre items smaller */
    .genre-option .p-3 {
        padding: 0.625rem !important;
    }
    
    .genre-option i {
        font-size: 1.25rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    .genre-option p {
        font-size: 0.75rem !important;
    }
    
    /* Mood pills - horizontal scroll */
    .flex.flex-wrap.gap-3 {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 0.5rem !important;
        margin: 0 -1rem !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .mood-option {
        flex-shrink: 0 !important;
    }
    
    .mood-option .px-4.py-2 {
        padding: 0.5rem 0.75rem !important;
    }
    
    .mood-option span.text-lg {
        font-size: 1rem !important;
    }
    
    .mood-option span.text-sm {
        font-size: 0.75rem !important;
    }
    
    /* Prompt suggestions scroll */
    .mt-4 .flex.flex-wrap.gap-2 {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 0.5rem !important;
    }
    
    .prompt-suggestion {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }
    
    /* Input fields */
    .input-field {
        font-size: 16px !important; /* Prevent iOS zoom */
        padding: 0.875rem 1rem !important;
    }
    
    .input-field.text-lg {
        font-size: 16px !important;
    }
    
    /* Lyrics textarea */
    #songLyrics {
        min-height: 150px !important;
        font-size: 14px !important;
    }
    
    /* Advanced options sliders */
    input[type="range"] {
        height: 8px !important;
    }
    
    /* Submit buttons */
    .flex.flex-col.sm\:flex-row {
        flex-direction: column !important;
    }
    
    .flex.flex-col.sm\:flex-row button {
        width: 100% !important;
    }
    
    /* Sidebar cards */
    .space-y-6 > .card {
        padding: 1rem !important;
    }
    
    /* Credits card */
    .w-16.h-16 {
        width: 3rem !important;
        height: 3rem !important;
    }
    
    .w-16.h-16 i {
        font-size: 1.25rem !important;
    }
    
    .text-3xl.font-bold {
        font-size: 1.5rem !important;
    }
    
    /* Tips list */
    .space-y-3.text-sm li {
        font-size: 0.8125rem !important;
    }
    
    /* Generation modal */
    #generationModal > div {
        margin: 1rem !important;
        padding: 1.5rem !important;
    }
    
    #generationModal .w-24.h-24 {
        width: 4rem !important;
        height: 4rem !important;
    }
    
    #generationModal h3 {
        font-size: 1.125rem !important;
    }
}

/* Very small screens */
@media (max-width: 380px) {
    /* Genre grid single column */
    .grid.grid-cols-3.md\:grid-cols-5 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Even smaller padding */
    .card.p-6 {
        padding: 0.75rem !important;
    }
}

/* Explore Page Mobile */
@media (max-width: 768px) {
    /* Filter buttons */
    .flex.gap-2.overflow-x-auto {
        padding-bottom: 8px !important;
        -webkit-overflow-scrolling: touch;
    }
    
    .flex.gap-2.overflow-x-auto button {
        flex-shrink: 0 !important;
        padding: 8px 16px !important;
        font-size: 0.875rem !important;
    }
}

/* Profile Page Mobile */
@media (max-width: 768px) {
    /* Profile header */
    .flex.items-end.space-x-6 {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }
    
    .w-32.h-32 {
        width: 100px !important;
        height: 100px !important;
    }
    
    /* Stats row */
    .flex.items-center.space-x-6 {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 16px !important;
    }
}

/* Pricing Page Mobile */
@media (max-width: 768px) {
    .grid.md\:grid-cols-3 {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }
    
    /* Pricing card */
    .card.p-8 {
        padding: 24px !important;
    }
}

/* Dashboard Mobile */
@media (max-width: 768px) {
    /* Stats cards */
    .grid.grid-cols-2.md\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    .grid.grid-cols-2.md\:grid-cols-4 .card {
        padding: 16px !important;
    }
    
    /* Large numbers */
    .text-3xl, .text-4xl {
        font-size: 1.5rem !important;
    }
}

/* Settings Page Mobile */
@media (max-width: 768px) {
    /* Tabs */
    .flex.space-x-2.border-b {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 2px !important;
    }
    
    .flex.space-x-2.border-b button {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }
}

/* Footer Mobile */
@media (max-width: 768px) {
    footer .grid.md\:grid-cols-4 {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
        text-align: center !important;
    }
    
    footer .flex.space-x-4 {
        justify-content: center !important;
    }
    
    footer ul.space-y-2 {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 8px 16px !important;
    }
    
    footer ul.space-y-2 li {
        margin: 0 !important;
    }
}

/* Modal Mobile */
@media (max-width: 768px) {
    .fixed.inset-0.flex.items-center.justify-center {
        align-items: flex-end !important;
    }
    
    .fixed.inset-0 .max-w-lg,
    .fixed.inset-0 .max-w-xl,
    .fixed.inset-0 .max-w-2xl {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        border-radius: 1rem 1rem 0 0 !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
}

/* Auth Pages Mobile */
@media (max-width: 768px) {
    .max-w-md {
        max-width: 100% !important;
        padding: 0 16px !important;
    }
    
    .min-h-screen.flex.items-center {
        padding-top: 80px !important;
        padding-bottom: 40px !important;
    }
}

/* Song Detail Page Mobile */
@media (max-width: 768px) {
    .flex.md\:flex-row {
        flex-direction: column !important;
    }
    
    /* Cover image */
    .w-64, .w-80 {
        width: 200px !important;
        height: 200px !important;
        margin: 0 auto !important;
    }
    
    /* Action buttons */
    .flex.items-center.space-x-4 {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .flex.items-center.space-x-4 button,
    .flex.items-center.space-x-4 a {
        flex: 1 1 auto !important;
        min-width: 44px !important;
        justify-content: center !important;
    }
}

/* Notifications Mobile */
@media (max-width: 768px) {
    /* Notification dropdown positioning */
    #notifDropdown {
        position: fixed !important;
        left: 8px !important;
        right: 8px !important;
        top: auto !important;
        bottom: 70px !important;
        max-width: none !important;
        width: auto !important;
    }
}

/* Contact Page Mobile */
@media (max-width: 768px) {
    .contact-info-content section.info {
        grid-template-columns: 1fr !important;
    }
}

/* About Page Mobile */
@media (max-width: 768px) {
    .about-page-content section.stats {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .about-page-content section.values {
        grid-template-columns: 1fr !important;
    }
}

/* Touch friendly spacing */
@media (max-width: 768px) {
    /* Links and buttons minimum touch area */
    a, button {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    /* List items spacing */
    ul li a, nav a {
        padding: 10px 0 !important;
    }
    
    /* Better tap targets */
    .space-x-4 > * {
        min-width: 44px !important;
        min-height: 44px !important;
    }
}

/* Smooth scrolling on iOS */
* {
    -webkit-tap-highlight-color: transparent;
}

.overflow-x-auto, .overflow-y-auto {
    -webkit-overflow-scrolling: touch;
}

/* Safe area padding for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    footer {
        padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important;
    }
    
    #globalPlayer {
        padding-bottom: env(safe-area-inset-bottom) !important;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
}
