/* Piper TTS Frontend Styles - Complete */

:root {
    --piper-primary: #6366f1;
    --piper-primary-dark: #4f46e5;
    --piper-primary-light: #818cf8;
    --piper-success: #22c55e;
    --piper-warning: #f59e0b;
    --piper-error: #ef4444;
    --piper-info: #3b82f6;
    --piper-bg: #0f0f1a;
    --piper-bg-secondary: #16162a;
    --piper-card: #1e1e32;
    --piper-border: #2d2d4a;
    --piper-text: #e4e4e7;
    --piper-text-muted: #9ca3af;
    --piper-radius: 12px;
    --piper-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Container */
.piper-tts-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--piper-text);
    background: var(--piper-bg);
    min-height: 500px;
    border-radius: var(--piper-radius);
}

/* Cards */
.piper-tts-card {
    background: var(--piper-card);
    border: 1px solid var(--piper-border);
    border-radius: var(--piper-radius);
    padding: 40px;
}

.piper-tts-card--center {
    text-align: center;
    max-width: 500px;
    margin: 60px auto;
}

.piper-tts-card h2 {
    margin: 20px 0 10px;
    font-size: 24px;
    font-weight: 600;
}

.piper-tts-card p {
    color: var(--piper-text-muted);
    margin-bottom: 25px;
}

/* Icons */
.piper-tts-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 10px;
}

.piper-tts-icon--warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--piper-warning);
}

/* Buttons */
.piper-tts-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.piper-tts-btn--primary {
    background: linear-gradient(135deg, var(--piper-primary), var(--piper-primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.piper-tts-btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.piper-tts-btn--secondary {
    background: var(--piper-bg-secondary);
    color: var(--piper-text);
    border: 1px solid var(--piper-border);
}

.piper-tts-btn--success {
    background: linear-gradient(135deg, var(--piper-success), #16a34a);
    color: white;
}

.piper-tts-btn--ghost {
    background: transparent;
    color: var(--piper-text-muted);
    padding: 8px 16px;
}

.piper-tts-btn--ghost:hover {
    background: var(--piper-bg-secondary);
    color: var(--piper-text);
}

.piper-tts-btn--large {
    padding: 18px 32px;
    font-size: 16px;
}

.piper-tts-btn--block {
    width: 100%;
}

.piper-tts-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.piper-tts-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Alert */
.piper-tts-alert {
    padding: 16px 20px;
    border-radius: var(--piper-radius);
    margin-bottom: 20px;
}

.piper-tts-alert--warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--piper-warning);
}

/* Header */
.piper-tts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--piper-card);
    border-radius: var(--piper-radius);
    margin-bottom: 24px;
    border: 1px solid var(--piper-border);
}

.piper-tts-header__user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.piper-tts-avatar {
    width: 40px;
    height: 40px;
    background: var(--piper-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

/* Badge */
.piper-tts-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.piper-tts-badge--success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--piper-success);
}

.piper-tts-badge--warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--piper-warning);
}

.piper-tts-badge--info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--piper-info);
}

/* Pricing */
.piper-tts-pricing-header {
    text-align: center;
    margin-bottom: 30px;
}

.piper-tts-pricing-header h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.piper-tts-pricing-header p {
    color: var(--piper-text-muted);
}

.piper-tts-trial-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: var(--piper-radius);
    margin-bottom: 30px;
}

.piper-tts-trial-banner__content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.piper-tts-trial-banner__icon {
    font-size: 32px;
}

.piper-tts-trial-banner p {
    margin: 5px 0 0;
    font-size: 13px;
    color: var(--piper-text-muted);
}

.piper-tts-pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.piper-tts-plan {
    background: var(--piper-card);
    border: 1px solid var(--piper-border);
    border-radius: var(--piper-radius);
    padding: 30px;
    position: relative;
    transition: all 0.3s ease;
}

.piper-tts-plan:hover {
    border-color: var(--piper-primary);
    transform: translateY(-4px);
}

.piper-tts-plan--popular {
    border-color: var(--piper-primary);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.2);
}

.piper-tts-plan__badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--piper-primary);
    color: white;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.piper-tts-plan__name {
    font-size: 20px;
    margin: 0 0 8px;
}

.piper-tts-plan__description {
    color: var(--piper-text-muted);
    font-size: 13px;
    margin-bottom: 20px;
}

.piper-tts-plan__price {
    margin-bottom: 20px;
}

.piper-tts-plan__amount {
    font-size: 32px;
    font-weight: 700;
    color: var(--piper-primary-light);
}

.piper-tts-plan__period {
    color: var(--piper-text-muted);
    font-size: 14px;
}

.piper-tts-plan__features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
}

.piper-tts-plan__features li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 14px;
    color: var(--piper-text-muted);
}

.piper-tts-plan__features svg {
    color: var(--piper-success);
    flex-shrink: 0;
}

/* Modal */
.piper-tts-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.piper-tts-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
}

.piper-tts-modal__content {
    position: relative;
    background: var(--piper-card);
    border-radius: var(--piper-radius);
    padding: 30px;
    max-width: 420px;
    width: 90%;
    text-align: center;
}

.piper-tts-modal__close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--piper-text-muted);
    font-size: 24px;
    cursor: pointer;
}

.piper-tts-payment-qr img {
    max-width: 200px;
    margin: 20px 0;
    border-radius: 8px;
}

.piper-tts-payment-note {
    background: var(--piper-bg-secondary);
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    text-align: left;
}

.piper-tts-payment-note code {
    display: block;
    background: var(--piper-primary);
    color: white;
    padding: 10px;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    margin: 10px 0;
    letter-spacing: 2px;
}

/* Loader */
.piper-tts-loader {
    text-align: center;
    padding: 80px 20px;
}

.piper-tts-loader__spinner svg {
    animation: spin 1s linear infinite;
    color: var(--piper-primary);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.piper-tts-loader h3 {
    margin: 20px 0 10px;
}

.piper-tts-loader p {
    color: var(--piper-text-muted);
}

.piper-tts-progress {
    height: 6px;
    background: var(--piper-border);
    border-radius: 3px;
    margin: 25px auto;
    max-width: 300px;
    overflow: hidden;
}

.piper-tts-progress__bar {
    height: 100%;
    background: linear-gradient(90deg, var(--piper-primary), var(--piper-primary-light));
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* TTS Interface */
.piper-tts-interface {
    background: var(--piper-card);
    border: 1px solid var(--piper-border);
    border-radius: var(--piper-radius);
    padding: 30px;
}

.piper-tts-section {
    margin-bottom: 24px;
}

.piper-tts-section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.piper-tts-section__header label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--piper-text);
}

.piper-tts-section__header svg {
    color: var(--piper-primary);
}

.piper-tts-text-stats {
    font-size: 13px;
    color: var(--piper-text-muted);
}

.piper-tts-textarea {
    width: 100%;
    padding: 16px;
    background: var(--piper-bg-secondary);
    border: 1px solid var(--piper-border);
    border-radius: 8px;
    color: var(--piper-text);
    font-size: 15px;
    line-height: 1.7;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}

.piper-tts-textarea:focus {
    outline: none;
    border-color: var(--piper-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.piper-tts-textarea::placeholder {
    color: var(--piper-text-muted);
}

.piper-tts-input-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* Controls */
.piper-tts-controls {
    display: flex;
    gap: 30px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.piper-tts-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.piper-tts-control label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--piper-text-muted);
}

.piper-tts-control input[type="range"] {
    width: 120px;
    accent-color: var(--piper-primary);
}

.piper-tts-control__value {
    min-width: 35px;
    font-weight: 600;
    color: var(--piper-primary-light);
}

/* Generating */
.piper-tts-generating {
    text-align: center;
    padding: 40px;
}

.piper-tts-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 50px;
    margin-bottom: 15px;
}

.piper-tts-waveform span {
    width: 4px;
    height: 20px;
    background: var(--piper-primary);
    border-radius: 2px;
}

.piper-tts-waveform--animated span {
    animation: wave 1s ease-in-out infinite;
}

.piper-tts-waveform--animated span:nth-child(1) {
    animation-delay: 0s;
}

.piper-tts-waveform--animated span:nth-child(2) {
    animation-delay: 0.1s;
}

.piper-tts-waveform--animated span:nth-child(3) {
    animation-delay: 0.2s;
}

.piper-tts-waveform--animated span:nth-child(4) {
    animation-delay: 0.3s;
}

.piper-tts-waveform--animated span:nth-child(5) {
    animation-delay: 0.4s;
}

.piper-tts-waveform--animated span:nth-child(6) {
    animation-delay: 0.5s;
}

.piper-tts-waveform--animated span:nth-child(7) {
    animation-delay: 0.6s;
}

.piper-tts-waveform--animated span:nth-child(8) {
    animation-delay: 0.7s;
}

.piper-tts-waveform--animated span:nth-child(9) {
    animation-delay: 0.8s;
}

.piper-tts-waveform--animated span:nth-child(10) {
    animation-delay: 0.9s;
}

@keyframes wave {

    0%,
    100% {
        height: 10px;
    }

    50% {
        height: 40px;
    }
}

/* Player */
.piper-tts-player {
    background: var(--piper-bg-secondary);
    border-radius: var(--piper-radius);
    padding: 24px;
    margin-top: 24px;
}

.piper-tts-player__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.piper-tts-player audio {
    width: 100%;
    margin-bottom: 16px;
}

.piper-tts-player__actions {
    text-align: center;
}

/* Model Selector */
.piper-tts-model-selector {
    margin-bottom: 24px;
}

.piper-tts-model-selector h2 {
    margin: 0 0 20px;
    font-size: 20px;
    text-align: center;
}

.piper-tts-model-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.piper-tts-model-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--piper-bg-secondary);
    border: 2px solid var(--piper-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.piper-tts-model-option:hover {
    border-color: var(--piper-primary);
}

.piper-tts-model-option.selected {
    border-color: var(--piper-primary);
    background: rgba(99, 102, 241, 0.1);
}

.piper-tts-model-option input[type="radio"] {
    display: none;
}

.piper-tts-model-option__icon {
    font-size: 28px;
}

.piper-tts-model-option__name {
    font-weight: 600;
    flex: 1;
}

.piper-tts-model-option__badge {
    font-size: 10px;
    padding: 3px 8px;
    background: var(--piper-primary);
    color: white;
    border-radius: 10px;
    text-transform: uppercase;
}

/* Custom Model */
.piper-tts-custom-model {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--piper-border);
}

.piper-tts-custom-model h4 {
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--piper-text-muted);
}

.piper-tts-custom-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.piper-tts-tab {
    padding: 10px 20px;
    background: var(--piper-bg-secondary);
    border: 1px solid var(--piper-border);
    border-radius: 8px;
    color: var(--piper-text-muted);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.piper-tts-tab:hover {
    border-color: var(--piper-primary);
}

.piper-tts-tab.active {
    background: var(--piper-primary);
    border-color: var(--piper-primary);
    color: white;
}

.piper-tts-tab-content {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.piper-tts-form-group {
    margin-bottom: 16px;
}

.piper-tts-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--piper-text-muted);
}

.piper-tts-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--piper-bg-secondary);
    border: 1px solid var(--piper-border);
    border-radius: 8px;
    color: var(--piper-text);
    font-size: 14px;
    box-sizing: border-box;
}

.piper-tts-input:focus {
    outline: none;
    border-color: var(--piper-primary);
}

.piper-tts-input::placeholder {
    color: var(--piper-text-muted);
}

.piper-tts-input[type="file"] {
    padding: 10px;
}

.piper-tts-input[type="file"]::-webkit-file-upload-button {
    padding: 8px 16px;
    margin-right: 12px;
    background: var(--piper-primary);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
}

/* Current Model */
.piper-tts-current-model {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--piper-bg-secondary);
    border-radius: 8px;
    margin-bottom: 20px;
}

.piper-tts-text-muted {
    color: var(--piper-text-muted);
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .piper-tts-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .piper-tts-trial-banner {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .piper-tts-pricing-grid {
        grid-template-columns: 1fr;
    }

    .piper-tts-actions {
        flex-direction: column;
    }
}