/* ============================================
   حميز نت - أدوات الميديا المتقدمة
   ============================================ */

:root {
    --primary: #00a651;
    --primary-dark: #006837;
    --primary-light: #22c55e;
    --primary-gradient: linear-gradient(135deg, #00a651, #22c55e);
    --secondary: #3399ff;
    --secondary-dark: #0066cc;
    --accent: #ffd700;
    --accent-dark: #ccab00;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
    --background: #000000;
    --background-secondary: #111111;
    --background-tertiary: #1a1a1a;
    --background-card: #1e1e1e;
    --background-elevated: #2a2a2a;
    --text: #ffffff;
    --text-muted: #cccccc;
    --text-light: #e5e5e5;
    --text-secondary: #b3b3b3;
    --border: #333333;
    --border-light: #404040;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.5);
    --shadow-primary: 0 8px 25px rgba(0, 166, 81, 0.3);
    --header-height: 70px;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    --transition: 0.3s ease;
    --glass-bg: rgba(26, 26, 26, 0.9);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-backdrop: blur(20px);
}

[data-theme="light"] {
    --background: #f8f9fa;
    --background-secondary: #ffffff;
    --background-tertiary: #f0f2f5;
    --background-card: #ffffff;
    --background-elevated: #ffffff;
    --text: #1a1a2e;
    --text-muted: #555555;
    --text-light: #333333;
    --text-secondary: #666666;
    --border: #e0e0e0;
    --border-light: #d0d0d0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.12);
    --shadow-primary: 0 8px 25px rgba(0, 166, 81, 0.15);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(0, 0, 0, 0.08);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 20%, rgba(0, 166, 81, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(51, 153, 255, 0.06) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

[data-theme="light"] body::before {
    background:
        radial-gradient(circle at 20% 20%, rgba(0, 166, 81, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(51, 153, 255, 0.03) 0%, transparent 50%);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-light);
}

/* Header */
.main-header {
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: var(--glass-backdrop);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 998;
    height: var(--header-height);
    border-bottom: 1px solid rgba(0, 166, 81, 0.2);
    transition: all var(--transition);
}

[data-theme="light"] .main-header {
    background: rgba(255, 255, 255, 0.97);
    border-bottom-color: rgba(0, 166, 81, 0.15);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
}

.logo-section {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 800;
    text-decoration: none;
}

.logo svg {
    color: var(--accent);
}

.logo-tagline {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.nav-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
    background: rgba(0, 166, 81, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.theme-toggle-btn:hover {
    background: rgba(0, 166, 81, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 4px;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
}

.hamburger-line {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
    transition: all var(--transition);
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 999;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.mobile-menu.show {
    visibility: visible;
    opacity: 1;
}

.mobile-menu-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.mobile-menu-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 85vw;
    height: 100%;
    background: rgba(0, 0, 0, 0.98);
    backdrop-filter: var(--glass-backdrop);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

[data-theme="light"] .mobile-menu-content {
    background: rgba(255, 255, 255, 0.98);
}

.mobile-menu.show .mobile-menu-content {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 700;
}

.mobile-logo svg {
    color: var(--accent);
}

.mobile-menu-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary);
}

.mobile-nav {
    flex: 1;
    padding: 1rem 0;
}

.mobile-nav-link {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-nav-link:hover {
    background: rgba(0, 166, 81, 0.1);
    color: var(--primary);
}

/* Main Content */
.main-content {
    padding-top: var(--header-height);
}

/* Hero Section */
.hero-section {
    padding: 4rem 0 3rem;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 1rem;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.7;
}

.tools-grid-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.tool-nav-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 1.5rem 1rem;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.tool-nav-card svg {
    color: var(--primary);
    transition: transform var(--transition);
}

.tool-nav-card span {
    font-size: 0.85rem;
    font-weight: 600;
}

.tool-nav-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    background: rgba(0, 166, 81, 0.08);
    box-shadow: var(--shadow-primary);
    color: var(--text);
}

.tool-nav-card:hover svg {
    transform: scale(1.15);
}

/* Tool Sections */
.tool-section {
    padding: 4rem 0;
}

.tool-section.alt-bg {
    background: var(--background-tertiary);
}

.tool-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.tool-panel-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.tool-panel-header svg {
    color: var(--primary);
}

.tool-panel-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.tool-panel-desc {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* Settings */
.recorder-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.setting-group select,
.setting-group input[type="text"],
.setting-group input[type="number"] {
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--background-elevated);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all var(--transition);
}

.setting-group select option {
    background: var(--background-card);
    color: var(--text);
}

[data-theme="light"] .setting-group select,
[data-theme="light"] .setting-group input[type="text"],
[data-theme="light"] .setting-group input[type="number"] {
    background: #ffffff;
    color: #1a1a2e;
    border-color: #d0d0d0;
}

[data-theme="light"] .setting-group select option {
    background: #ffffff;
    color: #1a1a2e;
}

.setting-group select:focus,
.setting-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.15);
}

.setting-group input[type="color"] {
    width: 100%;
    height: 38px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
}

.setting-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-light);
    appearance: none;
    outline: none;
    margin-top: 0.5rem;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.checkbox-group {
    justify-content: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Preview Area */
.recorder-preview {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.preview-placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.preview-placeholder svg {
    color: var(--border-light);
    margin-bottom: 1rem;
}

.preview-placeholder p {
    margin: 0;
    font-size: 0.9rem;
}

#screenVideo {
    width: 100%;
    height: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--border-radius);
}

.pip-overlay {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 180px;
    height: 135px;
    border-radius: 10px;
    border: 2px solid var(--primary);
    object-fit: cover;
    z-index: 5;
    box-shadow: var(--shadow);
}

.countdown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

#countdownNumber {
    font-size: 6rem;
    font-weight: 800;
    color: var(--primary);
    animation: countdownPulse 1s ease-in-out infinite;
}

@keyframes countdownPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* Recorder Controls */
.recorder-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

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

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    background: var(--secondary);
    color: white;
    box-shadow: 0 8px 25px rgba(51, 153, 255, 0.3);
}

.btn-lg {
    padding: 0.9rem 2rem;
    font-size: 1rem;
}

/* Timer */
.recording-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--danger);
    font-variant-numeric: tabular-nums;
}

.timer-dot {
    width: 12px;
    height: 12px;
    background: var(--danger);
    border-radius: 50%;
    animation: timerBlink 1s infinite;
}

@keyframes timerBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-light);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 2rem;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(0, 166, 81, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(0, 166, 81, 0.1);
    transform: scale(1.01);
}

.upload-area svg {
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-area p {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.95rem;
}

.upload-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Trim workspace */
.trim-workspace,
.gif-workspace,
.convert-workspace,
.effects-workspace,
.watermark-workspace {
    margin-bottom: 2rem;
}

.trim-workspace video,
.gif-workspace video,
.convert-workspace video,
.effects-workspace video,
.watermark-workspace video {
    width: 100%;
    max-height: 350px;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    background: #000;
}

.trim-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.trim-range label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.trim-range input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-light);
    appearance: none;
    outline: none;
}

.trim-range input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

/* Progress */
.trim-progress {
    margin-top: 1.5rem;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

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

/* Results */
.recorder-result {
    margin-top: 2rem;
    padding: 2rem;
    background: rgba(0, 166, 81, 0.05);
    border: 1px solid rgba(0, 166, 81, 0.2);
    border-radius: var(--border-radius);
}

.recorder-result h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.recorder-result video,
.recorder-result audio {
    width: 100%;
    max-height: 350px;
    border-radius: 8px;
    margin-bottom: 1rem;
    background: #000;
}

.recorder-result img {
    width: 100%;
    max-height: 350px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 1rem;
    background: var(--background);
}

.result-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Audio Visualizer */
.audio-visualizer {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    overflow: hidden;
}

#audioCanvas {
    width: 100%;
    height: 150px;
    display: block;
}

/* Filters Grid */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.filter-btn {
    padding: 0.7rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-btn:hover {
    border-color: var(--primary);
    background: rgba(0, 166, 81, 0.08);
}

.filter-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: var(--primary);
}

/* File Info */
.file-info {
    padding: 1rem;
    background: rgba(0, 166, 81, 0.05);
    border: 1px solid rgba(0, 166, 81, 0.15);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Footer */
.main-footer {
    background: rgba(0, 0, 0, 0.9);
    padding: 4rem 0 1.5rem;
    border-top: 1px solid rgba(0, 166, 81, 0.2);
}

[data-theme="light"] .main-footer {
    background: var(--background-tertiary);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.footer-logo svg {
    color: var(--accent);
}

.footer-description {
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 0.9rem;
}

.footer-title {
    color: var(--primary);
    margin-bottom: 1.25rem;
    font-size: 1rem;
    font-weight: 700;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.6rem;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-bottom-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.copyright, .footer-brand {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-brand a {
    color: var(--primary);
    font-weight: 600;
}

/* Floating Buttons */
.floating-buttons {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 90;
}

.float-button {
    background: var(--primary-gradient);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all var(--transition);
    border: none;
    opacity: 0;
    transform: translateY(20px);
}

.float-button.visible {
    opacity: 1;
    transform: translateY(0);
}

.float-button:hover {
    transform: scale(1.1) translateY(0);
    box-shadow: var(--shadow-primary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    background: var(--success);
    color: white;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    opacity: 0;
    transform: translateX(-100%);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 400px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--info); }

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-grow: 1;
}

.toast-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    font-size: 0.8rem;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Range value display */
.range-value {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
    text-align: center;
}

/* Annotation Toolbar */
.annotation-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--background-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.toolbar-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-left: 0.5rem;
}

.anno-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.anno-btn:hover { border-color: var(--primary); background: rgba(0,166,81,0.1); }
.anno-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.anno-color {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
    background: transparent;
}

.anno-size {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--background-elevated);
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
}

[data-theme="light"] .anno-size {
    background: #fff;
    color: #1a1a2e;
}

/* Annotation Canvas */
.annotation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 6;
    cursor: crosshair;
}

/* Dual Upload */
.dual-upload {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Subtitle Entries */
.subtitle-entries {
    margin-bottom: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.sub-entry {
    display: grid;
    grid-template-columns: 80px 80px 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.sub-entry input {
    padding: 0.5rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--background-elevated);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
}

[data-theme="light"] .sub-entry input {
    background: #fff;
    color: #1a1a2e;
}

.sub-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* File List (Merger) */
.file-list {
    margin-bottom: 1rem;
}

.file-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--background-elevated);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text);
}

.file-list-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-list-item .file-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.1rem;
}

/* Frames Grid */
.frames-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.frame-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    background: var(--background);
}

.frame-item img {
    width: 100%;
    display: block;
}

.frame-item button {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: inherit;
}

/* Split Results */
.split-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.split-result-item {
    padding: 1rem;
    background: rgba(0,166,81,0.05);
    border: 1px solid rgba(0,166,81,0.2);
    border-radius: var(--border-radius);
}

.split-result-item h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.split-result-item video {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: #000;
}

/* AI Settings */
.ai-settings-form {
    max-width: 600px;
}

.ai-settings-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.ai-settings-form textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    background: var(--background-elevated);
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
    margin-bottom: 1rem;
    direction: ltr;
    text-align: left;
}

[data-theme="light"] .ai-settings-form textarea {
    background: #fff;
    color: #1a1a2e;
}

.ai-settings-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,166,81,0.15);
}

.ai-settings-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.key-count {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}

.ai-model-info {
    padding: 1rem;
    background: rgba(0,166,81,0.05);
    border: 1px solid rgba(0,166,81,0.15);
    border-radius: 8px;
    font-size: 0.85rem;
}

.ai-model-info p {
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.ai-model-info p:last-child {
    margin-bottom: 0;
}

.ai-model-info strong {
    color: var(--primary);
}

/* Watermark Tabs */
.watermark-type-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.wm-tab {
    padding: 0.6rem 1.5rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.wm-tab:hover { border-color: var(--primary); background: rgba(0,166,81,0.08); }
.wm-tab.active { background: var(--primary-gradient); color: white; border-color: var(--primary); }

.upload-area-sm {
    padding: 1.5rem 1rem;
    margin-bottom: 1rem;
}

/* Additional workspace styles */
#speedWorkspace video,
#reverseWorkspace video,
#extractWorkspace video,
#framesWorkspace video,
#splitWorkspace video,
#thumbWorkspace video,
#subWorkspace video {
    width: 100%;
    max-height: 350px;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    background: #000;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .container {
        padding: 0 1rem;
    }

    .tool-panel {
        padding: 1.5rem;
    }

    .tools-grid-nav {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.75rem;
    }

    .tool-nav-card {
        padding: 1rem 0.75rem;
    }

    .tool-nav-card span {
        font-size: 0.75rem;
    }

    .recorder-settings {
        grid-template-columns: 1fr;
    }

    .trim-controls {
        grid-template-columns: 1fr;
    }

    .filters-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .recorder-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-lg {
        justify-content: center;
    }

    .pip-overlay {
        width: 120px;
        height: 90px;
        bottom: 8px;
        right: 8px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
    }

    .hero-section {
        padding: 3rem 0 2rem;
    }

    .tool-section {
        padding: 3rem 0;
    }

    .dual-upload {
        grid-template-columns: 1fr;
    }

    .sub-entry {
        grid-template-columns: 1fr 1fr;
    }

    .sub-entry input:last-child {
        grid-column: span 2;
    }

    .frames-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .split-results {
        grid-template-columns: 1fr;
    }

    .annotation-toolbar {
        gap: 0.3rem;
    }
}

@media (max-width: 480px) {
    .tools-grid-nav {
        grid-template-columns: repeat(2, 1fr);
    }

    .header-content {
        padding: 0 1rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 1.6rem;
    }

    .toast {
        left: 0.75rem;
        right: 0.75rem;
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==================== LIGHTBOX / FRAME PREVIEW ==================== */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    left: 0;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-actions {
    display: flex;
    gap: 0.5rem;
}

/* ==================== REORDER LIST ==================== */
.reorder-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem;
    color: var(--text);
}

.reorder-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.reorder-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--background-elevated);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    cursor: grab;
    transition: border-color 0.2s, transform 0.2s;
    min-width: 120px;
}

.reorder-item:active {
    cursor: grabbing;
    transform: scale(1.05);
}

.reorder-item.dragging {
    opacity: 0.5;
    border-color: var(--primary);
}

.reorder-item.drag-over {
    border-color: var(--primary-light);
    background: rgba(0, 166, 81, 0.1);
}

.reorder-item video {
    width: 100px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.reorder-item span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.reorder-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

#reorderPreviewArea {
    margin: 1rem 0;
}

#reorderPreviewArea video {
    width: 100%;
    max-height: 300px;
    border-radius: 12px;
}

/* ==================== REVERSE DIRECTION ==================== */
.reverse-direction-controls {
    margin: 1.5rem 0;
}

.reverse-direction-controls h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.direction-options {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.direction-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1rem 1.25rem;
    background: var(--background-elevated);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
}

.direction-btn:hover {
    border-color: var(--primary);
    color: var(--text);
}

.direction-btn.active {
    border-color: var(--primary);
    background: rgba(0, 166, 81, 0.15);
    color: var(--primary-light);
}

/* ==================== SUBTITLE ENHANCEMENTS ==================== */
.ai-timer-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: rgba(0, 166, 81, 0.1);
    border: 1px solid rgba(0, 166, 81, 0.3);
    border-radius: 10px;
    margin: 1rem 0;
    font-weight: 600;
    color: var(--primary-light);
}

.ai-timer-icon::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-light);
    animation: pulse-dot 1.2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.sub-language-section {
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: var(--background-elevated);
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.sub-language-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.language-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.lang-btn {
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.lang-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: var(--primary);
}

.custom-lang-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.custom-lang-row input {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--background-card);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
}

.sub-position-section {
    margin: 1.5rem 0;
}

.sub-position-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.sub-position-preview {
    position: relative;
    width: 100%;
    height: 200px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin: 0.75rem 0;
    border: 1px solid var(--border-light);
}

.sub-position-text {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: grab;
    user-select: none;
    white-space: nowrap;
}

.sub-position-text:active {
    cursor: grabbing;
}

/* Frame items clickable */
.frame-item {
    cursor: pointer;
    transition: transform 0.2s;
}

.frame-item:hover {
    transform: scale(1.03);
}

/* Fullscreen video button */
.video-fullscreen-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
}

.video-fullscreen-wrap video {
    width: 100%;
    max-height: 350px;
    border-radius: var(--border-radius);
    background: #000;
}

.fullscreen-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s, background 0.2s;
    z-index: 5;
    backdrop-filter: blur(4px);
}

.video-fullscreen-wrap:hover .fullscreen-btn {
    opacity: 1;
}

.fullscreen-btn:hover {
    background: rgba(0, 166, 81, 0.8);
}

.video-fullscreen-wrap:fullscreen,
.video-fullscreen-wrap:-webkit-full-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.video-fullscreen-wrap:fullscreen video,
.video-fullscreen-wrap:-webkit-full-screen video {
    max-height: 100vh;
    max-width: 100vw;
    border-radius: 0;
}

.video-fullscreen-wrap:fullscreen .fullscreen-btn,
.video-fullscreen-wrap:-webkit-full-screen .fullscreen-btn {
    opacity: 1;
    top: 20px;
    left: 20px;
}
