/**
 * PWA Components Styles
 */

/* Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 600px;
    margin: 0 auto;
    background: var(--surface-1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 20px;
    z-index: 9999;
    transform: translateY(150%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid var(--primary);
}

.pwa-install-banner.show {
    transform: translateY(0);
    opacity: 1;
}

.install-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.install-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.install-text {
    flex: 1;
}

.install-text strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.install-text p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.install-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Update Notification */
.pwa-update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    background: var(--surface-1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 20px;
    z-index: 9999;
    transform: translateX(450px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--primary);
}

.pwa-update-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.update-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.update-icon {
    font-size: 2rem;
    flex-shrink: 0;
    animation: rotate 2s linear infinite;
}

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

.update-text {
    flex: 1;
}

.update-text strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 4px;
}

.update-text p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* iOS Instructions */
.ios-instructions {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.ios-instructions .install-text p {
    color: rgba(255, 255, 255, 0.9);
}

.ios-instructions .btn-ghost {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.ios-instructions .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* QR Modal Styles */
.qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.qr-modal.show {
    opacity: 1;
}

.qr-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.qr-dialog {
    position: relative;
    background: var(--surface-1);
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.qr-modal.show .qr-dialog {
    transform: scale(1);
}

.qr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 2px solid var(--surface-3);
}

.qr-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.qr-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--surface-2);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.qr-close:hover {
    background: var(--error);
    color: white;
}

.qr-body {
    padding: 24px;
}

.qr-loading {
    text-align: center;
    padding: 40px 20px;
}

.qr-loading .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--surface-3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

.qr-code-container {
    text-align: center;
    padding: 20px;
}

.qr-code-container img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

.qr-instructions {
    text-align: center;
    padding: 20px;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    margin: 20px 0;
}

.qr-instructions p {
    margin: 0;
    color: var(--text-secondary);
}

.qr-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

/* Voice Recorder */
.voice-recorder {
    background: var(--surface-1);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    margin: 0 auto;
}

.recorder-header {
    text-align: center;
    margin-bottom: 32px;
}

.recorder-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.recorder-subtitle {
    color: var(--text-secondary);
}

.recorder-visual {
    position: relative;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.waveform-bars {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
}

.wave-bar {
    width: 4px;
    height: 20%;
    background: var(--gradient-primary);
    border-radius: 2px;
    transition: height 0.1s ease;
}

.record-button-container {
    position: relative;
    z-index: 1;
}

.record-button {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--primary);
    background: var(--gradient-primary);
    color: white;
    font-size: 3rem;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.record-button:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.6);
}

.record-button.recording {
    animation: pulse 1.5s ease-in-out infinite;
    background: var(--gradient-accent);
    border-color: #f5576c;
}

.recorder-timer {
    text-align: center;
    font-size: 2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    margin-bottom: 16px;
}

.timer-max {
    font-size: 1.2rem;
    color: var(--text-tertiary);
}

.recorder-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.status-icon {
    font-size: 1.5rem;
}

.status-text {
    font-weight: 600;
}

.recorder-status.status-recording {
    background: rgba(245, 87, 108, 0.1);
    color: #f5576c;
}

.recorder-status.status-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.recorder-status.status-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.audio-player {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.player-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--gradient-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

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

.player-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-track {
    flex: 1;
    height: 6px;
    background: var(--surface-3);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    transition: width 0.1s linear;
}

.player-time {
    font-size: 0.9rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.delete-btn {
    background: transparent;
    color: var(--error);
    border: 2px solid var(--error);
}

.delete-btn:hover {
    background: var(--error);
    color: white;
}

.recorder-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.recorder-info {
    background: var(--surface-2);
    padding: 20px;
    border-radius: var(--radius-md);
}

.recorder-info p {
    margin: 0 0 12px 0;
    font-weight: 600;
}

.recorder-info ul {
    margin: 0;
    padding-left: 24px;
}

.recorder-info li {
    margin: 8px 0;
    color: var(--text-secondary);
}

/* PWA Mode Adjustments */
.pwa-mode .pwa-install-banner {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .pwa-install-banner,
    .pwa-update-notification {
        left: 10px;
        right: 10px;
        max-width: none;
    }

    .install-content,
    .update-content {
        flex-direction: column;
        text-align: center;
    }

    .install-actions {
        width: 100%;
        justify-content: center;
    }

    .voice-recorder {
        padding: 20px;
    }

    .qr-actions {
        flex-direction: column;
    }

    .qr-actions button {
        width: 100%;
    }
}
