/**
 * Suno Music Generator Styles
 * Responsive design with mobile-first approach
 */

/* Reset and Base Styles */
.suno-music-generator-container * {
    box-sizing: border-box;
}

.suno-music-generator-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Alert Messages */
.alert {
    padding: 12px 15px;
    border-radius: 6px;
    margin: 15px 0;
    font-size: 14px;
    line-height: 1.4;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.song-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 13px;
}

/* Results Section */
.results-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.song-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.song-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.song-title {
    margin: 0;
    color: #333;
    font-size: 18px;
    flex: 1;
}

.song-style {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 10px;
}

.song-content {
    display: grid;
    gap: 15px;
}

.song-audio audio {
    width: 100%;
    height: 40px;
}

.song-lyrics h5 {
    margin: 0 0 8px 0;
    color: #555;
    font-size: 14px;
    font-weight: 600;
}

.song-lyrics p {
    margin: 0;
    line-height: 1.6;
    color: #666;
    font-size: 14px;
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

/* Usage Info Styles */
.usage-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    text-align: center;
}

.usage-stats {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
}

.remaining-text {
    opacity: 0.9;
    font-size: 14px;
}

.limit-warning {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Form Styles */
.suno-music-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.required {
    color: #e74c3c;
    font-size: 16px;
}

.form-control {
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 16px; /* Prevents iOS zoom */
    background: #fff;
    transition: all 0.3s ease;
    resize: vertical;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control:invalid {
    border-color: #e74c3c;
}

.form-help {
    margin-top: 5px;
    font-size: 12px;
    color: #7f8c8d;
    line-height: 1.4;
}

/* Select Styles */
select.form-control {
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23666" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Radio Group Styles */
.radio-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 5px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    background: #fff;
    transition: all 0.3s ease;
    min-width: 120px;
    justify-content: center;
}

.radio-option:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.radio-option input[type="radio"] {
    margin: 0;
    transform: scale(1.2);
}

.radio-option input[type="radio"]:checked + .radio-label {
    color: #667eea;
    font-weight: 600;
}

.radio-option:has(input:checked) {
    border-color: #667eea;
    background: #f8f9ff;
}

.radio-label {
    font-size: 14px;
    user-select: none;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #7f8c8d;
    transform: translateY(-1px);
}

.btn-link {
    background: transparent;
    color: #667eea;
    text-decoration: underline;
    padding: 8px;
    min-height: auto;
}

.btn-link:hover {
    color: #5a6fd8;
    background: rgba(102, 126, 234, 0.1);
    text-decoration: none;
}

.btn-icon {
    font-size: 18px;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Spinner Animation */
.spinner, .loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Lyrics Actions */
.lyrics-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* Action Group */
.action-group {
    margin-top: 30px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Messages */
.error-messages, .success-messages {
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 14px;
    line-height: 1.5;
}

.error-messages {
    background: #fdf2f2;
    color: #e74c3c;
    border: 1px solid #fadadd;
}

.success-messages {
    background: #f0f9f4;
    color: #16a085;
    border: 1px solid #a7f3d0;
}

/* Results Section */
.results-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e1e8ed;
}

.results-title {
    color: #2c3e50;
    margin-bottom: 25px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
}

.songs-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 20px;
}

/* Song Option Styles */
.song-option {
    background: #fff;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
}

.song-option:hover {
    border-color: #667eea;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.song-option.selected {
    border-color: #16a085;
    background: linear-gradient(135deg, #f0f9f4 0%, #e8f5e8 100%);
    box-shadow: 0 8px 30px rgba(22, 160, 133, 0.2);
}

.song-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 10px;
}

.song-title {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}

.song-style {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.song-player {
    margin-bottom: 15px;
}

.song-player audio {
    width: 100%;
    height: 40px;
    border-radius: 20px;
}

.song-info {
    margin-bottom: 15px;
    color: #7f8c8d;
    font-size: 14px;
}

.song-actions {
    display: flex;
    justify-content: center;
}

.select-song-btn {
    width: 100%;
    max-width: 200px;
}

.song-lyrics {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e1e8ed;
}

.song-lyrics h5 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 600;
}

.lyrics-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-line;
    max-height: 200px;
    overflow-y: auto;
    color: #2c3e50;
}

/* Selection Info */
.selection-info {
    text-align: center;
    padding: 15px;
    background: #f8f9ff;
    border-radius: 8px;
    color: #667eea;
    font-weight: 500;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    padding: 40px;
}

.loading-text {
    margin-top: 20px;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.loading-subtext {
    margin-top: 10px;
    font-size: 14px;
    color: #7f8c8d;
}

/* Simplified form styles */
.lyrics-group textarea {
    min-height: 120px;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
}

.form-help {
    font-style: italic;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .suno-music-generator-container {
        margin: 10px;
        padding: 15px;
    }
    
    .radio-group {
        flex-direction: column;
    }
    
    .radio-option {
        min-width: 100%;
    }
    
    .action-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .songs-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .song-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .song-style {
        align-self: flex-start;
    }
    
    .lyrics-actions {
        flex-direction: column;
    }
    
    .lyrics-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .suno-music-generator-container {
        margin: 5px;
        padding: 10px;
    }
    
    .usage-info {
        padding: 12px 15px;
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 14px;
        min-height: 44px; /* Touch-friendly */
    }
    
    .song-option {
        padding: 15px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .suno-music-generator-container {
        border: 2px solid #000;
    }
    
    .form-control {
        border-color: #000;
    }
    
    .btn-primary {
        background: #000;
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .suno-music-generator-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .btn, .song-player, .loading-overlay {
        display: none;
    }
}

/* Dark theme support */
.theme-dark {
    background: #2c3e50;
    color: #ecf0f1;
}

.theme-dark .form-control {
    background: #34495e;
    border-color: #4a5f7a;
    color: #ecf0f1;
}

.theme-dark .form-control:focus {
    border-color: #667eea;
}

.theme-dark .song-option {
    background: #34495e;
    border-color: #4a5f7a;
}

.theme-dark .lyrics-content {
    background: #2c3e50;
    color: #ecf0f1;
}

/* Generation Progress Styles */
.generation-progress {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
    border: 2px solid #1976d2 !important;
    color: #0d47a1 !important;
    font-weight: 600;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0% { 
        box-shadow: 0 0 5px rgba(25, 118, 210, 0.3); 
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 20px rgba(25, 118, 210, 0.6); 
        transform: scale(1.02);
    }
    100% { 
        box-shadow: 0 0 5px rgba(25, 118, 210, 0.3); 
        transform: scale(1);
    }
}

.generation-progress .fas {
    animation: spin 1.5s linear infinite;
    color: #1976d2 !important;
    font-size: 18px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ======================
   NEW FUNCTIONALITY STYLES 
   ====================== */

/* Voice Gender Selection */
.voice-group .radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.voice-group .radio-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
}

.voice-group .radio-item input[type="radio"] {
    margin-right: 8px;
    transform: scale(1.1);
}

/* Lyrics Generation */
.lyrics-generation {
    border: 2px solid #e3f2fd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    background: #f8f9ff;
}

.lyrics-generator-controls .theme-input-group {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    margin-top: 10px;
}

.lyrics-generator-controls #lyrics-theme {
    min-width: 0;
}

.lyrics-generator-controls #lyrics-mood {
    min-width: 140px;
}

.lyrics-generator-controls #generate-lyrics-btn {
    white-space: nowrap;
}

/* Enhanced Song Display */
.song-item {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    background: #fff;
    transition: all 0.3s ease;
}

.song-item:hover {
    border-color: #1976d2;
    box-shadow: 0 4px 15px rgba(25, 118, 210, 0.1);
}

.song-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.song-title {
    font-size: 18px;
    color: #333;
    margin: 0;
    font-weight: 600;
}

.song-meta {
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 14px;
}

.song-style {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.song-duration {
    color: #666;
    font-weight: 500;
}

.song-content {
    margin-bottom: 15px;
}

.song-info {
    margin-top: 15px;
}

.lyrics-content {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #1976d2;
    font-size: 14px;
    line-height: 1.6;
    max-height: 150px;
    overflow-y: auto;
}

.song-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    margin-top: 15px;
}

.song-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    padding: 8px 16px;
}

/* Cart Section */
.cart-section {
    margin-top: 30px;
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    background: #fafafa;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.cart-title {
    margin: 0;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-count {
    background: #1976d2;
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.cart-actions {
    display: flex;
    gap: 10px;
}

.cart-content {
    padding: 0;
}

.cart-songs {
    padding: 0;
}

.cart-song-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: white;
}

.cart-song-item:last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

.cart-song-info h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 16px;
}

.cart-song-info p {
    margin: 0 0 8px 0;
    color: #666;
    font-size: 14px;
}

.cart-song-info audio {
    width: 250px;
    height: 30px;
}

.cart-empty {
    padding: 30px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Button Variants */
.btn.btn-outline {
    background: transparent;
    border: 2px solid #1976d2;
    color: #1976d2;
}

.btn.btn-outline:hover {
    background: #1976d2;
    color: white;
}

.btn.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn.btn-danger {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn.btn-danger:hover {
    background: #c82333;
    border-color: #bd2130;
}

.btn.in-cart-btn {
    background: #28a745;
    border-color: #28a745;
    color: white;
    pointer-events: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .lyrics-generator-controls .theme-input-group {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .song-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .song-meta {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
    }
    
    .cart-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .cart-song-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .cart-song-info audio {
        width: 100%;
    }
    
    .song-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .suno-music-generator-container {
        padding: 15px;
        margin: 10px;
    }
    
    .voice-group .radio-group {
        flex-direction: column;
        gap: 10px;
    }
}