/* ==========================================================================
   ToolSphare AI Suite Tools — Unified Stylesheet
   Covers all 10 AI Tools with rich glassmorphism, responsive cards,
   audio visualizers, split sliders, caption editors & interactive widgets.
   ========================================================================== */

:root {
    --ai-bg-card: rgba(15, 23, 42, 0.85);
    --ai-bg-elevated: rgba(30, 41, 59, 0.7);
    --ai-bg-glass: rgba(15, 23, 42, 0.6);
    --ai-border: rgba(148, 163, 184, 0.16);
    --ai-border-hover: rgba(99, 102, 241, 0.4);
    --ai-primary: #6366f1;
    --ai-primary-hover: #4f46e5;
    --ai-primary-glow: rgba(99, 102, 241, 0.35);
    --ai-secondary: #06b6d4;
    --ai-accent: #f59e0b;
    --ai-success: #10b981;
    --ai-danger: #ef4444;
    --ai-text-main: #f8fafc;
    --ai-text-muted: #94a3b8;
    --ai-text-dim: #64748b;
    --ai-radius-lg: 16px;
    --ai-radius-md: 10px;
    --ai-radius-sm: 6px;
    --ai-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.05);
}

.ai-suite-tool {
    max-width: 1140px;
    margin: 0 auto;
    color: var(--ai-text-main);
    font-family: inherit;
}

/* Guarantee / Trust Header */
.ai-trust-badge-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}
.ai-trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #a5b4fc;
    letter-spacing: 0.01em;
}
.ai-trust-badge.success {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
}
.ai-trust-badge.warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
    color: #fcd34d;
}

/* Hero card */
.ai-hero-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.9) 100%);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-lg);
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--ai-shadow);
    backdrop-filter: blur(16px);
    position: relative;
    overflow: hidden;
}
.ai-hero-card::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, var(--ai-primary-glow) 0%, transparent 70%);
    pointer-events: none;
    border-radius: 50%;
}
.ai-hero-title {
    font-size: 1.85rem;
    font-weight: 800;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 40%, #c7d2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.ai-hero-desc {
    color: var(--ai-text-muted);
    font-size: 0.98rem;
    margin: 0;
    line-height: 1.55;
    max-width: 860px;
}

/* Nav Tabs */
.ai-tabs {
    display: flex;
    gap: 0.4rem;
    border-bottom: 1px solid var(--ai-border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 4px;
}
.ai-tab {
    padding: 0.65rem 1.15rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--ai-text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    border-radius: 6px 6px 0 0;
}
.ai-tab:hover {
    color: var(--ai-text-main);
    background: rgba(255, 255, 255, 0.04);
}
.ai-tab.active {
    color: #a5b4fc;
    border-bottom-color: var(--ai-primary);
    background: rgba(99, 102, 241, 0.08);
}

/* Panels */
.ai-panel {
    display: none;
}
.ai-panel.active {
    display: block;
    animation: aiFadeIn 0.25s ease;
}
@keyframes aiFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards & Sections */
.ai-card {
    background: var(--ai-bg-card);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--ai-shadow);
    backdrop-filter: blur(14px);
}
.ai-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ai-text-main);
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.ai-card-subtitle {
    font-size: 0.85rem;
    color: var(--ai-text-muted);
    font-weight: 400;
}

/* Upload Dropzone */
.ai-dropzone {
    border: 2px dashed rgba(99, 102, 241, 0.35);
    border-radius: var(--ai-radius-lg);
    background: rgba(2, 6, 23, 0.4);
    padding: 2.25rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}
.ai-dropzone:hover,
.ai-dropzone.dragover {
    border-color: var(--ai-primary);
    background: rgba(99, 102, 241, 0.08);
    transform: scale(1.005);
}
.ai-dropzone-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 1rem;
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.12);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ai-dropzone-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ai-text-main);
    margin: 0 0 0.35rem;
}
.ai-dropzone-sub {
    font-size: 0.84rem;
    color: var(--ai-text-muted);
    margin: 0 0 0.85rem;
}
.ai-dropzone-limits {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
}
.ai-limit-tag {
    padding: 0.2rem 0.55rem;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 4px;
    font-size: 0.74rem;
    color: #cbd5e1;
}

/* Progress Tracking Stages */
.ai-progress-box {
    display: none;
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-md);
    padding: 1.25rem;
    margin: 1.25rem 0;
}
.ai-progress-stages {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.78rem;
    color: var(--ai-text-muted);
}
.ai-stage-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
}
.ai-stage-item.active {
    color: #a5b4fc;
}
.ai-stage-item.done {
    color: var(--ai-success);
}
.ai-progress-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}
.ai-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #06b6d4);
    border-radius: 9999px;
    transition: width 0.3s ease;
}
.ai-progress-msg {
    margin-top: 0.6rem;
    font-size: 0.82rem;
    color: #cbd5e1;
    display: flex;
    justify-content: space-between;
}

/* Controls, Buttons, Sliders */
.ai-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--ai-radius-sm);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.ai-btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.ai-btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}
.ai-btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--ai-border);
    color: #e2e8f0;
}
.ai-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}
.ai-btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
}
.ai-btn-outline {
    background: transparent;
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
}
.ai-btn-outline:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #ffffff;
}
.ai-btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
}
.ai-btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}
.ai-btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #ffffff;
}

/* Form Controls */
.ai-select,
.ai-input,
.ai-textarea {
    width: 100%;
    background: rgba(2, 6, 23, 0.7);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-sm);
    color: var(--ai-text-main);
    padding: 0.55rem 0.85rem;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}
.ai-select:focus,
.ai-input:focus,
.ai-textarea:focus {
    border-color: var(--ai-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}
.ai-textarea {
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

/* Slider Controls */
.ai-slider-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 0.65rem 0;
}
.ai-slider-label {
    min-width: 130px;
    font-size: 0.84rem;
    font-weight: 600;
    color: #cbd5e1;
}
.ai-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}
.ai-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #6366f1;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
}
.ai-slider-val {
    min-width: 48px;
    text-align: right;
    font-size: 0.82rem;
    font-weight: 700;
    color: #a5b4fc;
}

/* Waveform Canvas Container */
.ai-waveform-box {
    background: rgba(2, 6, 23, 0.8);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-md);
    padding: 1rem;
    margin: 1rem 0;
    position: relative;
}
.ai-waveform-canvas {
    width: 100%;
    height: 80px;
    display: block;
    border-radius: 4px;
}

/* Split-screen Comparison Slider */
.ai-split-viewer {
    position: relative;
    width: 100%;
    height: 380px;
    border-radius: var(--ai-radius-md);
    overflow: hidden;
    background: #020617;
    border: 1px solid var(--ai-border);
    user-select: none;
}
.ai-split-img-orig,
.ai-split-img-mod {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.ai-split-mod-wrap {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    overflow: hidden;
    border-right: 2px solid #6366f1;
    box-shadow: 2px 0 12px rgba(99, 102, 241, 0.4);
}
.ai-split-handle {
    position: absolute;
    top: 50%;
    right: -14px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #6366f1;
    border: 2px solid #ffffff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.65rem;
}
.ai-split-badge {
    position: absolute;
    top: 12px;
    padding: 0.25rem 0.65rem;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--ai-border);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
    z-index: 2;
}
.ai-split-badge.left { left: 12px; }
.ai-split-badge.right { right: 12px; }

/* Subtitle & Transcript List */
.ai-subtitle-list {
    max-height: 360px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 4px;
}
.ai-sub-row {
    background: rgba(2, 6, 23, 0.5);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-sm);
    padding: 0.65rem 0.85rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    transition: all 0.2s ease;
}
.ai-sub-row:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.05);
}
.ai-sub-row.active {
    border-color: var(--ai-primary);
    background: rgba(99, 102, 241, 0.12);
}
.ai-sub-time {
    font-size: 0.75rem;
    font-family: monospace;
    color: #a5b4fc;
    min-width: 90px;
    cursor: pointer;
}
.ai-sub-text {
    flex: 1;
    font-size: 0.88rem;
    color: var(--ai-text-main);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
}
.ai-sub-text:focus {
    border-color: var(--ai-primary);
    background: rgba(2, 6, 23, 0.8);
    outline: none;
}
.ai-sub-actions {
    display: flex;
    gap: 0.3rem;
}

/* Multi-Stem Mixer Channels */
.ai-mixer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.ai-stem-strip {
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.2s ease;
}
.ai-stem-strip.muted {
    opacity: 0.45;
}
.ai-stem-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--ai-text-main);
}
.ai-fader-wrap {
    height: 120px;
    display: flex;
    align-items: center;
    margin: 0.75rem 0;
}
.ai-stem-fader {
    -webkit-appearance: slider-vertical;
    writing-mode: bt-lr;
    height: 100px;
    width: 24px;
}
.ai-stem-btns {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

/* Chat Q&A Document Stream */
.ai-chat-thread {
    height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem;
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-md);
    margin-bottom: 1rem;
}
.ai-msg {
    max-width: 82%;
    padding: 0.85rem 1.15rem;
    border-radius: var(--ai-radius-md);
    font-size: 0.92rem;
    line-height: 1.55;
}
.ai-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: #ffffff;
    border-bottom-right-radius: 2px;
}
.ai-msg-ai {
    align-self: flex-start;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--ai-border);
    color: var(--ai-text-main);
    border-bottom-left-radius: 2px;
}
.ai-cite-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 4px;
    color: #a5b4fc;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 0.4rem;
    margin-right: 0.3rem;
}
.ai-cite-chip:hover {
    background: rgba(99, 102, 241, 0.3);
    color: #ffffff;
}

/* Presentation Slide Deck */
.ai-deck-viewer {
    background: #020617;
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-md);
    padding: 1.5rem;
    aspect-ratio: 16 / 9;
    max-height: 440px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
}
.ai-slide-content {
    max-width: 85%;
    margin: 0 auto;
    text-align: left;
}
.ai-slide-title {
    font-size: 1.65rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: #ffffff;
}
.ai-slide-bullets {
    font-size: 1rem;
    line-height: 1.65;
    color: #cbd5e1;
    padding-left: 1.25rem;
}

/* Plagiarism Similarity Gauge */
.ai-plag-gauge {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 1.5rem;
    text-align: center;
}
.ai-gauge-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-size: 1.85rem;
    font-weight: 900;
    margin-bottom: 0.75rem;
    border: 6px solid var(--ai-primary);
    background: rgba(99, 102, 241, 0.08);
}
.ai-match-exact {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    border-bottom: 2px solid #ef4444;
    cursor: pointer;
}
.ai-match-near {
    background: rgba(245, 158, 11, 0.25);
    color: #fcd34d;
    border-bottom: 2px solid #f59e0b;
    cursor: pointer;
}
.ai-match-quoted {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border-bottom: 2px solid #10b981;
}

/* Voice Cloning Consent Box */
.ai-consent-box {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--ai-radius-sm);
    padding: 1rem;
    margin: 1rem 0;
    font-size: 0.85rem;
    color: #fde68a;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ai-hero-card {
        padding: 1.25rem;
    }
    .ai-hero-title {
        font-size: 1.45rem;
    }
    .ai-split-viewer {
        height: 260px;
    }
    .ai-slider-row {
        flex-direction: column;
        align-items: stretch;
    }
    .ai-slider-label {
        min-width: unset;
    }
    .ai-chat-thread {
        height: 280px;
    }
}
