/* ===== Analyze Page Styles ===== */

.analyze-page {
    padding: calc(var(--nav-height) + 80px) 0 60px;
    min-height: 100vh;
}

.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
    padding: 6px;
    background: var(--bg-card);
    border-radius: 16px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    background: var(--accent-gradient);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ===== Analyze Grid ===== */
.analyze-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 32px;
}

@media (max-width: 1024px) {
    .analyze-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Upload Zone ===== */
.upload-zone {
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.upload-zone:hover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-zone.drag-over {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--accent-gradient);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
}

.upload-zone h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.upload-zone p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

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

.upload-formats span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.upload-formats i {
    color: var(--accent-primary);
}

.upload-limits {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Preview Section ===== */
.preview-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.file-name {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

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

.btn-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--risk-critical);
    border-color: var(--risk-critical);
    color: white;
}

.preview-content {
    padding: 20px;
}

/* Audio Preview */
.audio-preview {
    text-align: center;
}

.waveform-container {
    position: relative;
    height: 100px;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    cursor: pointer;
}

#waveformCanvas {
    width: 100%;
    height: 100%;
}

.playhead {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    transition: left 0.1s linear;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
}

.play-btn {
    width: 50px;
    height: 50px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

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

.time-display {
    font-size: 14px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Video Preview */
.video-preview {
    position: relative;
}

.video-preview video {
    width: 100%;
    border-radius: 12px;
    display: block;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px 12px 0 0;
    transition: opacity var(--transition-fast);
}

.play-btn-large {
    width: 70px;
    height: 70px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

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

.video-timeline {
    padding: 12px 0;
}

.timeline-track {
    position: relative;
    height: 40px;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
}

.timeline-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--accent-gradient);
    opacity: 0.3;
    transition: width 0.1s linear;
}

.timeline-heatmap {
    position: absolute;
    top: 0;
    left: 30%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(249, 115, 22, 0.3) 20%,
        rgba(239, 68, 68, 0.5) 50%,
        rgba(249, 115, 22, 0.3) 80%,
        transparent 100%
    );
}

/* Image Preview */
.image-preview {
    text-align: center;
}

.image-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.image-container img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    display: block;
}

.heatmap-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.image-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.img-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.img-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* ===== Progress Section ===== */
.progress-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px;
    margin-top: 24px;
}

.progress-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: 500;
}

.progress-header i {
    color: var(--accent-primary);
    animation: pulse 1s ease-in-out infinite;
}

.progress-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== Result Section ===== */
.result-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.result-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.result-badge {
    padding: 4px 12px;
    background: var(--bg-secondary);
    border-radius: 50px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Risk Gauge */
.risk-gauge-container {
    text-align: center;
    margin-bottom: 24px;
}

.risk-gauge {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: conic-gradient(var(--accent-primary) 0deg, rgba(255,255,255,0.1) 0deg);
    position: relative;
}

.gauge-inner {
    width: 130px;
    height: 130px;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.risk-score {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
}

.risk-text {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.risk-label {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Confidence */
.confidence-section {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.confidence-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.confidence-header span:last-child {
    font-weight: 600;
    color: var(--accent-primary);
}

.confidence-bar-container {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.confidence-bar {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 1s ease;
    width: 0%;
}

/* Signals */
.signals-count {
    font-size: 13px;
    color: var(--text-muted);
}

.signals-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.signal-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border-left: 3px solid transparent;
}

.signal-item.high { border-left-color: var(--risk-critical); }
.signal-item.medium { border-left-color: var(--risk-medium); }
.signal-item.low { border-left-color: var(--risk-low); }

.signal-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.signal-item.high .signal-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--risk-critical);
}

.signal-item.medium .signal-icon {
    background: rgba(234, 179, 8, 0.1);
    color: var(--risk-medium);
}

.signal-item.low .signal-icon {
    background: rgba(34, 197, 94, 0.1);
    color: var(--risk-low);
}

.signal-content {
    flex: 1;
    min-width: 0;
}

.signal-title {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.signal-desc {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.signal-badge {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

.signal-badge.high {
    background: rgba(239, 68, 68, 0.1);
    color: var(--risk-critical);
}

.signal-badge.medium {
    background: rgba(234, 179, 8, 0.1);
    color: var(--risk-medium);
}

.signal-badge.low {
    background: rgba(34, 197, 94, 0.1);
    color: var(--risk-low);
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.result-actions .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
}

/* Empty Result */
.empty-result {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
}

.empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--bg-secondary);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--text-muted);
}

.empty-result h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.empty-result p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== Text Analysis ===== */
.text-analyze-container {
    max-width: 900px;
    margin: 0 auto;
}

.text-input-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 24px;
}

.text-input-section h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

#textInput {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 16px;
}

#textInput:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.text-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.text-scores {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.text-score-item {
    text-align: center;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.text-score-item .score-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.text-score-item .score-value.low { color: var(--risk-low); }
.text-score-item .score-value.medium { color: var(--risk-medium); }
.text-score-item .score-value.high { color: var(--risk-high); }
.text-score-item .score-value.critical { color: var(--risk-critical); }

.text-score-item .score-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.legend {
    display: flex;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-item i {
    font-size: 8px;
}

.legend-item.ai-high i { color: var(--risk-critical); }
.legend-item.ai-medium i { color: var(--risk-medium); }
.legend-item.ai-low i { color: var(--risk-low); }

.highlighted-text {
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    line-height: 1.8;
    font-size: 14px;
}

.sentence {
    padding: 2px 4px;
    border-radius: 4px;
    cursor: help;
}

.sentence.ai-high {
    background: rgba(239, 68, 68, 0.2);
}

.sentence.ai-medium {
    background: rgba(234, 179, 8, 0.2);
}

.sentence.ai-low {
    background: rgba(34, 197, 94, 0.1);
}

/* ===== URL Analysis ===== */
.url-analyze-container {
    max-width: 700px;
    margin: 0 auto;
}

.url-input-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 48px;
    text-align: center;
}

.url-input-section h3 {
    font-size: 24px;
    margin-bottom: 8px;
}

.url-input-section > p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.url-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 8px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: 24px;
}

.url-input-wrapper i {
    color: var(--text-muted);
}

.url-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}

.url-input-wrapper input::placeholder {
    color: var(--text-muted);
}

.url-input-wrapper .btn {
    padding: 12px 20px;
}

.url-examples span {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.source-badges {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.source-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-radius: 50px;
    font-size: 13px;
    color: var(--text-secondary);
}

.source-badge i {
    color: var(--accent-primary);
}
