/* ===== CSS RESET ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===== CSS VARIABLES ===== */
:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #1a1a24;
    --bg-tertiary: #24242f;
    --bg-elevated: #2a2a38;

    --purple-primary: #8b5cf6;
    --purple-light: #a78bfa;
    --purple-dark: #7c3aed;
    --purple-glow: rgba(139, 92, 246, 0.3);
    --purple-glow-strong: rgba(139, 92, 246, 0.5);

    --text-primary: #e0e0e8;
    --text-secondary: #a0a0b0;
    --text-tertiary: #606070;
    --text-disabled: #404050;

    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    --border-color: rgba(139, 92, 246, 0.15);
    --border-focus: rgba(139, 92, 246, 0.5);

    /* Typography */
    --font-primary: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'Roboto', sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-purple: 0 8px 24px var(--purple-glow);
}

/* ===== GLOBAL STYLES ===== */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== MOCK MODE BADGE ===== */
.mock-badge {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--warning);
    border-radius: 6px;
    color: var(--warning);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
    backdrop-filter: blur(10px);
    animation: fadeIn var(--transition-base);
}

.mock-badge svg {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== LAYOUT ===== */
#app {
    min-height: 100vh;
    position: relative;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: var(--space-6);
    animation: fadeIn var(--transition-base);
}

.screen.active {
    display: block;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 768px) {
    .screen {
        padding: var(--space-12) var(--space-6);
    }

    .container {
        max-width: 540px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 600px;
    }
}

/* ===== HERO SECTION ===== */
.hero {
    text-align: center;
    margin-bottom: var(--space-12);
}

.logo {
    width: 64px;
    height: 64px;
    color: var(--purple-primary);
    margin: 0 auto var(--space-4);
    filter: drop-shadow(0 4px 12px var(--purple-glow));
}

.title {
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
    background: linear-gradient(135deg, var(--purple-light), var(--purple-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 400;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: var(--space-6);
}

.label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.optional {
    color: var(--text-tertiary);
    font-weight: 400;
}

.input {
    width: 100%;
    padding: var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: var(--text-base);
    font-family: var(--font-primary);
    transition: all var(--transition-fast);
    outline: none;
}

.input:focus {
    border-color: var(--purple-primary);
    box-shadow: 0 0 0 3px var(--purple-glow);
}

.input::placeholder {
    color: var(--text-tertiary);
}

.input:disabled, .input:read-only {
    opacity: 0.6;
    cursor: not-allowed;
}

.input-large {
    padding: var(--space-6);
    font-size: var(--text-lg);
}

.hint {
    margin-top: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

/* Input with validation checkmark */
.input-validated {
    position: relative;
}

.input-validated .input {
    padding-right: var(--space-12);
}

.icon-check {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--success);
}

/* Password input */
.input-password-wrapper {
    position: relative;
}

.input-password-wrapper .input {
    padding-right: var(--space-12);
}

.btn-toggle-password {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: var(--space-2);
    cursor: pointer;
    color: var(--text-tertiary);
    transition: color var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-toggle-password:hover {
    color: var(--purple-primary);
}

.icon-eye {
    width: 20px;
    height: 20px;
}

/* Resolution inputs */
.input-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.input-row .input {
    flex: 1;
}

.input-separator {
    color: var(--text-tertiary);
    font-size: var(--text-lg);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-6);
    border-radius: 8px;
    font-size: var(--text-base);
    font-weight: 600;
    font-family: var(--font-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    outline: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--purple-primary), var(--purple-dark));
    color: white;
    box-shadow: 0 4px 12px var(--purple-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--purple-glow-strong);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

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

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

.btn-secondary:hover:not(:disabled) {
    border-color: var(--purple-primary);
    color: var(--purple-primary);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    border-color: var(--purple-primary);
    color: var(--purple-primary);
}

.btn-large {
    width: 100%;
    padding: var(--space-6);
    font-size: var(--text-lg);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-family: var(--font-primary);
    cursor: pointer;
    padding: var(--space-2) 0;
    margin-bottom: var(--space-6);
    transition: color var(--transition-fast);
}

.btn-back:hover {
    color: var(--purple-primary);
}

/* ===== ADVANCED SECTION ===== */
.advanced-section {
    margin-bottom: var(--space-6);
}

.advanced-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    user-select: none;
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-secondary);
    padding: var(--space-3) 0;
    transition: color var(--transition-fast);
}

.advanced-toggle:hover {
    color: var(--purple-primary);
}

.advanced-toggle::before {
    content: '▶';
    font-size: var(--text-sm);
    transition: transform var(--transition-fast);
}

.advanced-section[open] .advanced-toggle::before {
    transform: rotate(90deg);
}

.advanced-content {
    padding-top: var(--space-4);
}

/* ===== AUTOCOMPLETE ===== */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: var(--space-2);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.autocomplete-dropdown.hidden {
    display: none;
}

.autocomplete-item {
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: background-color var(--transition-fast);
    font-size: var(--text-sm);
}

.autocomplete-item:hover, .autocomplete-item.selected {
    background: var(--bg-tertiary);
}

.autocomplete-item:first-child {
    border-radius: 8px 8px 0 0;
}

.autocomplete-item:last-child {
    border-radius: 0 0 8px 8px;
}

.autocomplete-loading {
    padding: var(--space-4);
    text-align: center;
    color: var(--text-tertiary);
    font-size: var(--text-sm);
}

/* ===== EXAMPLES ===== */
.examples {
    margin-top: var(--space-12);
    text-align: center;
}

.examples-title {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-bottom: var(--space-3);
    font-weight: 500;
}

.examples-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.examples-list li {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* ===== SCREEN TITLES ===== */
.screen-title {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-8);
}

/* ===== PROGRESS ===== */
.progress-container {
    margin-bottom: var(--space-8);
}

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

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--purple-primary), var(--purple-light));
    border-radius: 4px;
    transition: width var(--transition-base);
    box-shadow: 0 0 12px var(--purple-glow);
}

.progress-text {
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ===== STATS ===== */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-12);
}

.stat {
    text-align: center;
    padding: var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.stat-value {
    display: block;
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.stat-value.stat-primary {
    color: var(--purple-primary);
}

.stat-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== STREAMS SECTION ===== */
.streams-section {
    margin-top: var(--space-12);
}

.streams-section.hidden {
    display: none;
}

.section-title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-6);
}

/* ===== STREAMS LIST ===== */
.streams-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    padding: var(--space-2);
}

/* ===== STREAM GROUPS ===== */
.stream-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.stream-group-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-fast);
}

.stream-group-header:hover {
    color: var(--purple-primary);
}

.stream-group-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}

.stream-group-toggle .chevron {
    transition: transform var(--transition-fast);
}

.stream-group.collapsed .stream-group-toggle .chevron {
    transform: rotate(-90deg);
}

.stream-group.collapsed .stream-group-content {
    display: none;
}

.stream-group-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stream-group-count {
    font-size: var(--text-sm);
    font-weight: 400;
    color: var(--text-tertiary);
}

.stream-group-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.stream-group-empty {
    padding: var(--space-4);
    text-align: center;
    color: var(--text-tertiary);
    font-size: var(--text-sm);
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
}

/* ===== STREAM SUBGROUPS (Main/Sub/Other within Recommended) ===== */
.stream-subgroup {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.stream-subgroup:not(:last-child) {
    margin-bottom: var(--space-4);
}

.stream-subgroup-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding-left: var(--space-2);
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-fast);
}

.stream-subgroup-header:hover {
    color: var(--purple-primary);
}

.stream-subgroup-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}

.stream-subgroup-toggle .chevron {
    transition: transform var(--transition-fast);
}

.stream-subgroup.collapsed .stream-subgroup-toggle .chevron {
    transform: rotate(-90deg);
}

.stream-subgroup.collapsed .stream-subgroup-content {
    display: none;
}

.stream-subgroup-title {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stream-subgroup-count {
    font-size: var(--text-xs);
    font-weight: 400;
    color: var(--text-disabled);
}

.stream-subgroup-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

/* Custom scrollbar */
.streams-list::-webkit-scrollbar {
    width: 8px;
}

.streams-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.streams-list::-webkit-scrollbar-thumb {
    background: var(--purple-primary);
    border-radius: 4px;
}

.streams-list::-webkit-scrollbar-thumb:hover {
    background: var(--purple-light);
}

/* Stream item */
.stream-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all var(--transition-base);
    overflow: hidden;
}

.stream-item:hover {
    border-color: var(--purple-primary);
    box-shadow: 0 4px 12px var(--purple-glow);
}

.stream-item.expanded {
    border-color: var(--purple-primary);
}

/* Stream item header */
.stream-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4);
    cursor: pointer;
}

.stream-item-main {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
    min-width: 0;
}

.stream-info-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex: 1;
    min-width: 0;
}

.stream-type-badge {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--purple-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.stream-type-badge svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.stream-url-preview {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stream-toggle {
    background: none;
    border: none;
    padding: var(--space-2);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stream-toggle:hover {
    color: var(--purple-primary);
}

.stream-toggle .chevron {
    transition: transform var(--transition-fast);
}

.stream-item.expanded .stream-toggle .chevron {
    transform: rotate(180deg);
}

.btn-use-stream {
    flex-shrink: 0;
    white-space: nowrap;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
}

/* Stream item details */
.stream-item-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-base);
    padding: 0 var(--space-4);
}

.stream-item-details.visible {
    max-height: 500px;
    padding: 0 var(--space-4) var(--space-4) var(--space-4);
}

.stream-url-full {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-primary);
    word-break: break-all;
    margin-bottom: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.stream-meta-item {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.stream-meta-item:last-child {
    margin-bottom: 0;
}

.meta-label {
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== SELECTED STREAM INFO ===== */
.stream-selection-container {
    margin-bottom: var(--space-6);
}

.selected-stream-info {
    padding: var(--space-6);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: var(--space-4);
    position: relative;
}

.selected-stream-info:last-child {
    margin-bottom: var(--space-6);
}

.stream-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-3);
}

.selected-type {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--purple-primary);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.selected-url {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    word-break: break-all;
}

.sub-stream {
    border-color: rgba(139, 92, 246, 0.3);
}

.btn-remove-sub {
    margin-top: var(--space-4);
    padding: var(--space-2) var(--space-4);
    background: transparent;
    border: 1px solid var(--error);
    border-radius: 6px;
    color: var(--error);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

/* ===== TABS ===== */
.tabs {
    margin-bottom: var(--space-6);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tabs-scroll {
    display: flex;
    gap: var(--space-2);
    min-width: min-content;
}

.tab {
    padding: var(--space-3) var(--space-6);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

.tab.active {
    background: var(--purple-primary);
    border-color: var(--purple-primary);
    color: white;
    box-shadow: 0 4px 12px var(--purple-glow);
}

.tab-content {
    position: relative;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn var(--transition-fast);
}

.config-code {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: var(--space-6);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-primary);
    overflow-x: auto;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ===== ACTIONS ===== */
.actions {
    display: flex;
    gap: var(--space-3);
    margin-top: 10px;
    margin-bottom: var(--space-4);
}

.actions .btn {
    flex: 1;
}

.secondary-actions {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.secondary-actions .btn {
    flex: 1;
}

.secondary-actions .btn-primary {
    flex: 1.2;
}

.secondary-actions .btn-outline {
    flex: 0.8;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: var(--space-6);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: var(--space-4) var(--space-6);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    color: var(--text-primary);
    z-index: 1000;
    transition: transform var(--transition-base);
    max-width: 90%;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.hidden {
    display: none;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    opacity: 0;
    transition: opacity var(--transition-base);
    padding: var(--space-4);
}

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

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

.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: var(--space-8);
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform var(--transition-base);
    text-align: center;
}

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

.modal-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--error);
    margin-bottom: var(--space-4);
}

.modal-message {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-8);
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: var(--space-3);
}

.modal-actions .btn {
    flex: 1;
    padding: var(--space-4);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* ===== FRIGATE TAB CUSTOM STYLES ===== */
.frigate-input-section {
    margin-bottom: var(--space-6);
}

.frigate-label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.frigate-label .hint {
    display: block;
    font-weight: 400;
    color: var(--text-tertiary);
    font-size: var(--text-xs);
    margin-top: var(--space-1);
}

.frigate-config-input {
    width: 100%;
    min-height: 300px;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: var(--space-3) var(--space-4);
    color: var(--text-primary);
    resize: vertical;
    transition: all var(--transition-fast);
}

.frigate-config-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--purple-glow);
}

.btn-generate {
    width: 100%;
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-6);
    background: var(--purple-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px var(--purple-glow);
}

.btn-generate:hover {
    background: var(--purple-light);
    box-shadow: 0 8px 24px var(--purple-glow-strong);
    transform: translateY(-2px);
}

.btn-generate:active {
    transform: translateY(0);
}

/* Button with tooltip wrapper */
.button-with-tooltip {
    position: relative;
    width: 100%;
}

.button-with-tooltip .btn-generate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

/* Button with tooltip in secondary-actions */
.secondary-actions .button-with-tooltip {
    flex: 1.2;
    width: auto;
}

.secondary-actions .button-with-tooltip .btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.secondary-actions .button-with-tooltip:last-child {
    flex: 0.8;
}

/* Info icon inside button */
.info-icon-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    cursor: help;
    color: rgba(255, 255, 255, 0.7);
    transition: color var(--transition-fast);
}

.info-icon-button:hover {
    color: rgba(255, 255, 255, 1);
}

.info-icon-button svg {
    width: 18px;
    height: 18px;
}

/* Info icon inside outline button */
.info-icon-button-outline {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    cursor: help;
    color: var(--text-tertiary);
    transition: color var(--transition-fast);
}

.info-icon-button-outline:hover {
    color: var(--purple-primary);
}

.info-icon-button-outline svg {
    width: 18px;
    height: 18px;
}

/* Info icon inside stream type badge */
.info-icon-stream {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: var(--space-2);
    cursor: help;
    color: var(--text-tertiary);
    transition: color var(--transition-fast);
}

.info-icon-stream:hover {
    color: var(--purple-primary);
}

.info-icon-stream svg {
    width: 16px;
    height: 16px;
}

.frigate-output-section {
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-color);
    animation: slideIn 0.3s ease-out;
}

.frigate-output-section.hidden {
    display: none;
}

/* ===== TOOLTIPS ===== */
.label-with-info {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.info-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    cursor: help;
    color: var(--text-tertiary);
    transition: color var(--transition-fast);
}

.info-icon:hover {
    color: var(--purple-primary);
}

.info-icon svg {
    width: 16px;
    height: 16px;
}

.tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--purple-primary);
    border-radius: 8px;
    padding: var(--space-4);
    width: 320px;
    max-width: 90vw;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--purple-glow);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
    pointer-events: none;
}

/* Tooltip opens downward */
.tooltip.tooltip-down {
    bottom: auto;
    top: calc(100% + 8px);
}

.info-icon:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--purple-primary);
}

/* Arrow for downward tooltip */
.tooltip.tooltip-down::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--purple-primary);
}

.tooltip-title {
    font-weight: 600;
    color: var(--purple-primary);
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
}

.tooltip-text {
    font-size: var(--text-xs);
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

.tooltip-text:last-child {
    margin-bottom: 0;
}

.tooltip-examples {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-color);
}

.tooltip-examples-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-xs);
    margin-bottom: var(--space-2);
}

.tooltip-example {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--purple-light);
    background: var(--bg-secondary);
    padding: var(--space-1) var(--space-2);
    border-radius: 4px;
    margin-bottom: var(--space-1);
    display: block;
}

.tooltip-example:last-child {
    margin-bottom: 0;
}

/* ===== UTILITIES ===== */
.hidden {
    display: none !important;
}
