* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
                 'Microsoft YaHei', sans-serif;
    background: #fafafa;
    color: #333;
    min-height: 100vh;
    overflow: hidden;
}

/* Usage Widget - Bottom Left */
.usage-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 50;
}

.usage-widget.hidden {
    display: none;
}

.usage-toggle {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.usage-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    border-color: #4CAF50;
}

.usage-toggle:active {
    transform: translateY(0);
}

.usage-panel {
    position: absolute;
    bottom: 70px;
    left: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    min-width: 280px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.usage-panel:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.usage-panel.hidden {
    display: none;
}

.usage-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
}

.close-panel-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.close-panel-btn:hover {
    color: #333;
}

.usage-panel-content {
    padding: 20px;
}

.usage-text {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.5;
}

.plan-indicator {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-indicator.free {
    background: #e8f5e9;
    color: #2e7d32;
}

.plan-indicator.pro {
    color: #1565c0;
}

.plan-indicator.unlimited {
    background: #f3e5f5;
    color: #6a1b9a;
}

.quick-upgrade-btn {
    margin-left: 12px;
    padding: 4px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-upgrade-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.quick-upgrade-btn.hidden {
    display: none;
}

/* Settings Modal */
.api-setup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.api-setup.hidden {
    display: none;
}

.setup-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 520px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.setup-content h2 {
    margin-bottom: 24px;
    font-size: 1.5rem;
    font-weight: 300;
    color: #333;
}

.input-section {
    margin-bottom: 24px;
}

.input-section.optional {
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.input-section label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

.required {
    color: #ef4444;
    font-weight: bold;
}

.optional-tag {
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: normal;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 4px;
}

.setup-content input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 6px;
    transition: border-color 0.3s;
}

.setup-content input:focus {
    outline: none;
    border-color: #333;
}

.hint {
    display: block;
    font-size: 0.8rem;
    color: #667eea;
    text-decoration: none;
    margin-bottom: 4px;
}

.hint:hover {
    text-decoration: underline;
}

.btn-save {
    width: 100%;
    padding: 12px;
    background: #333;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 8px;
}

.btn-save:hover {
    background: #555;
}

.btn-secondary {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 8px;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: #333;
}

.btn-close {
    width: 100%;
    padding: 10px;
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 16px;
}

.btn-close:hover {
    background: #e8e8e8;
}

.btn-logout {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 12px;
}

.btn-logout:hover {
    background: #fef2f2;
}

.info-text {
    margin-top: 16px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #6b7280;
    text-align: center;
}

/* Modal Message */
.modal-message {
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 12px;
    text-align: center;
}

.modal-message.hidden {
    display: none;
}

.modal-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.modal-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.modal-message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Account Info */
.account-info {
    background: #f9fafb;
    border-radius: 8px;
    padding: 16px;
    margin-top: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 0.85rem;
    color: #6b7280;
}

.info-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

.plan-badge {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.plan-badge.free {
    background: #e8f5e9;
    color: #2e7d32;
}

.plan-badge.pro {
    background: #e3f2fd;
    color: #1565c0;
}

.plan-badge.unlimited {
    background: #f3e5f5;
    color: #6a1b9a;
}

/* Language Selector */
.language-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.language-item {
    flex: 1;
}

.sublabel {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 6px;
    font-weight: normal;
}

.language-selector select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.language-selector select:focus {
    outline: none;
    border-color: #333;
}

.language-arrow {
    font-size: 1.5rem;
    color: #bbb;
    margin-top: 20px;
    flex-shrink: 0;
}

/* Subscription Plans */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.plan-card {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    position: relative;
    transition: all 0.3s;
}

.plan-card:hover {
    border-color: #333;
    transform: translateY(-2px);
}

.plan-card.featured {
    border-color: #667eea;
    background: linear-gradient(135deg, #f6f8ff 0%, #ffffff 100%);
}

.plan-badge {
    position: absolute;
    top: -8px;
    right: 10px;
    background: #667eea;
    color: white;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.plan-card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    font-weight: 500;
}

.plan-price {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

.plan-price span {
    font-size: 0.85rem;
    font-weight: 400;
    color: #999;
}

.plan-features {
    list-style: none;
    margin-bottom: 16px;
    text-align: left;
}

.plan-features li {
    padding: 6px 0;
    font-size: 0.85rem;
    color: #666;
    position: relative;
    padding-left: 20px;
}

.plan-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: bold;
}

.btn-plan {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-plan.upgrade {
    background: #333;
    color: white;
}

.btn-plan.upgrade:hover {
    background: #555;
}

.btn-plan.current {
    background: #e8f5e9;
    color: #2e7d32;
    cursor: not-allowed;
}

/* Confirm Dialog */
.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.2s ease;
}

.confirm-dialog.hidden {
    display: none;
}

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

.confirm-content {
    background: white;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.3s ease;
}

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

.confirm-title {
    margin: 0 0 12px 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.confirm-message {
    margin: 0 0 24px 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #666;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.confirm-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.btn-cancel:hover {
    background: #e8e8e8;
}

.btn-confirm {
    background: #ef4444;
    color: white;
}

.btn-confirm:hover {
    background: #dc2626;
}

.confirm-btn:active {
    transform: scale(0.98);
}

/* Main Container */
.main-container {
    width: 100%;
    height: 100vh;
    position: relative;
}

/* Transcription Area */
.transcription-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100vh;
    gap: 1px;
    background: #e0e0e0;
}

.text-column {
    background: white;
    padding: 60px 70px 70px 70px;
    overflow-y: auto;
    position: relative;
}

.source-column {
    border-right: 1px solid #e0e0e0;
}

.source-column::before {
    content: attr(data-label);
    position: absolute;
    top: 20px;
    left: 40px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #999;
    font-weight: 500;
}

.target-column::before {
    content: attr(data-label);
    position: absolute;
    top: 20px;
    left: 40px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #999;
    font-weight: 500;
}

/* Copy Button */
.copy-btn {
    position: absolute;
    top: 18px;
    right: 40px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #bbb;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
    z-index: 10;
}

.text-column:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: #f5f5f5;
    color: #666;
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn.copied {
    color: #10b981;
}

.copy-btn.copied::after {
    content: '✓';
    position: absolute;
    font-size: 14px;
    font-weight: bold;
}

.text-display {
    font-size: 1.1rem;
    line-height: 2;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.text-display:empty::after {
    content: '...';
    color: #ddd;
    font-size: 2rem;
}

.source-column .text-display {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 1.1rem;
}

.target-column .text-display {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 1.1rem;
}

/* Scrollbar */
.text-column::-webkit-scrollbar {
    width: 6px;
}

.text-column::-webkit-scrollbar-track {
    background: transparent;
}

.text-column::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.text-column::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* Controls */
.controls {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}

.ctrl-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #666;
    backdrop-filter: blur(10px);
}

.ctrl-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.ctrl-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.start-btn {
    color: #10b981;
    font-size: 1.5rem;
}

.start-btn:hover:not(:disabled) {
    color: #059669;
}

.stop-btn {
    color: #ef4444;
    font-size: 1.2rem;
}

.stop-btn:hover:not(:disabled) {
    color: #dc2626;
}

.clear-btn {
    color: #6b7280;
    font-size: 1.3rem;
}

.clear-btn:hover {
    color: #4b5563;
}

.clear-btn:active {
    animation: clear-pulse 0.4s ease;
}

@keyframes clear-pulse {
    0% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.15) rotate(-5deg);
    }
    50% {
        transform: scale(1.15) rotate(5deg);
    }
    75% {
        transform: scale(1.15) rotate(-5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

.settings-btn {
    color: #6b7280;
    font-size: 1.2rem;
}

.settings-btn:hover {
    color: #4b5563;
}

/* Active Recording Indicator */
.start-btn.recording {
    background: #10b981;
    color: white;
    animation: pulse-record 1.5s infinite;
}

@keyframes pulse-record {
    0%, 100% {
        box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
    }
    50% {
        box-shadow: 0 2px 20px rgba(16, 185, 129, 0.6);
    }
}

/* Interim Transcript Indicator */
.interim-text {
    color: #9ca3af;
    opacity: 0.7;
    animation: text-pulse 1s ease-in-out infinite;
    font-style: italic;
}

@keyframes text-pulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 0.9;
    }
}

/* Status Toast */
.status-toast {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
    pointer-events: none;
    z-index: 200;
    max-width: 300px;
}

.status-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.status-toast.error {
    background: #ef4444;
}

.status-toast.success {
    background: #10b981;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .transcription-area {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .source-column {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .text-column {
        padding: 50px 70px 70px 70px;
    }

    .source-column::before,
    .target-column::before {
        left: 20px;
        top: 15px;
    }

    .copy-btn {
        right: 20px;
        top: 13px;
        opacity: 1;
    }

    .text-display {
        font-size: 1rem;
    }

    .source-column .text-display {
        font-size: 1rem;
    }

    .target-column .text-display {
        font-size: 1rem;
    }

    .controls {
        bottom: 20px;
        right: 20px;
        flex-direction: column;
        gap: 8px;
    }

    .ctrl-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .start-btn {
        font-size: 1.3rem;
    }

    .stop-btn {
        font-size: 1rem;
    }

    .clear-btn {
        font-size: 1.1rem;
    }

    .settings-btn {
        font-size: 1rem;
    }

    .language-selector {
        flex-direction: column;
        gap: 16px;
    }

    .language-arrow {
        transform: rotate(90deg);
        margin: 0;
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }
}

/* Tablet */
@media (max-width: 1024px) and (min-width: 769px) {
    .text-column {
        padding: 55px 70px 70px 70px;
    }

    .text-display {
        font-size: 1.05rem;
    }
}

/* Empty State */
.text-display:empty::after {
    content: '...';
    color: #ddd;
    font-size: 2rem;
}
