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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --surface-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 40px;
    background: var(--surface-color);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

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

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
}

.mobile-menu-btn span {
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.header-spacer {
    width: 45px;
}

header h1 {
    font-size: 2.5rem;
    margin: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    flex: 1;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* PWA Install Banner */
.install-banner {
    margin-top: 20px;
    padding: 15px;
    background: var(--surface-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    position: relative;
}

.install-banner-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.install-banner-content > span:first-child {
    font-weight: 600;
    color: var(--primary-color);
}

.install-instructions {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.install-banner #closeInstallBanner {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.install-banner #closeInstallBanner:hover {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .install-banner-content {
        padding-right: 30px;
    }
    
    .install-instructions {
        font-size: 0.85rem;
    }
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Add Download Section */
.add-download-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.form-card, .stats-card {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.form-card h2 {
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.form-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    font-weight: 400;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.site-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.site-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.site-select option {
    background: var(--surface-color);
    color: var(--text-primary);
    padding: 10px;
}

.checkbox-group {
    margin-top: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

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

.checkbox-text {
    font-size: 1rem;
    font-weight: 500;
}

.help-text {
    margin-top: 5px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Cam Sites Section */
.cam-sites-section {
    margin-top: 30px;
}

.cam-sites-card {
    border: 2px solid rgba(239, 68, 68, 0.3);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), rgba(239, 68, 68, 0.1));
}

.cam-sites-card h2 {
    color: #ff6b9d;
}

.cam-sites-info {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.info-box {
    padding: 15px 20px;
    border-radius: 10px;
    border-left: 4px solid;
}

.info-box strong {
    display: block;
    margin-bottom: 10px;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.info-box p {
    margin: 5px 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.info-box code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--primary-color);
}

.success-box {
    background: rgba(16, 185, 129, 0.1);
    border-left-color: var(--success-color);
}

.success-box strong {
    color: var(--success-color);
}

.tip-box {
    background: rgba(99, 102, 241, 0.1);
    border-left-color: var(--primary-color);
}

.tip-box strong {
    color: var(--primary-color);
}

.example-box {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: var(--warning-color);
}

.example-box strong {
    color: var(--warning-color);
}

.info-text {
    margin: 8px 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

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

.btn-cam {
    background: linear-gradient(135deg, #ff6b9d, #ff4757) !important;
}

.btn-cam:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 107, 157, 0.3);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

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

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
}

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

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

.btn-danger {
    background: var(--error-color);
    color: white;
}

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

.btn-icon {
    font-size: 1.2rem;
}

/* Stats Card */
.stats-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
    justify-content: center;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 10px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Downloads Section */
.downloads-section {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

/* Tabs Container */
.tabs-container {
    width: 100%;
}

.tabs-header {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    bottom: -2px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.tab-icon {
    font-size: 1.2rem;
}

.tab-label {
    font-size: 1rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

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

.section-header h2 {
    font-size: 1.5rem;
}

/* Downloads List */
.downloads-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.empty-subtitle {
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Download Card */
.download-card {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.download-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.download-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.download-info {
    flex: 1;
}

.download-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
    word-break: break-word;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.domain-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.download-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.meta-item a {
    transition: all 0.3s ease;
}

.meta-item a:hover {
    color: var(--secondary-color) !important;
    text-decoration: underline !important;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-downloading {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-color);
}

.status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
}

.status-completed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.status-stopped {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
}

.status-cancelled {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-secondary);
}

.status-error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error-color);
}

/* Progress Bar */
.download-progress {
    margin: 15px 0;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.875rem;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--surface-light);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.progress-stats {
    display: flex;
    gap: 20px;
    margin-top: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Download Actions */
.download-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* Live Badge */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(239, 68, 68, 0.2);
    color: var(--error-color);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--error-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

/* Live Recording Indicator */
.live-progress {
    background: rgba(99, 102, 241, 0.05);
    border: 2px dashed var(--primary-color);
    border-radius: 10px;
    padding: 20px;
}

.live-recording-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.live-dots {
    display: flex;
    gap: 8px;
}

.live-dot-anim {
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: dotPulse 1.5s ease-in-out infinite;
}

.live-dot-anim:nth-child(1) {
    animation-delay: 0s;
}

.live-dot-anim:nth-child(2) {
    animation-delay: 0.3s;
}

.live-dot-anim:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes dotPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }
}

.live-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    animation: textGlow 2s ease-in-out infinite;
}

@keyframes textGlow {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Toast Notifications */
#toastContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 20px;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--error-color);
}

.toast-info {
    border-left: 4px solid var(--primary-color);
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .add-download-section {
        grid-template-columns: 1fr;
    }
}

/* Mobil Menü */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    max-width: 85vw;
    height: 100%;
    background: var(--surface-color);
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
}

.mobile-nav.active {
    left: 0;
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.mobile-nav-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: white;
}

.mobile-nav-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

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

.mobile-nav-content {
    padding: 20px 0;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px 20px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    background: var(--surface-light);
    border-left-color: var(--primary-color);
}

.mobile-nav-item .nav-icon {
    font-size: 1.5rem;
    width: 30px;
    text-align: center;
}

/* Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    z-index: 998;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 0 4px;
}

.bottom-nav-item.active {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.bottom-nav-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.bottom-nav-label {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

section {
    scroll-margin-top: 20px;
}

@media (max-width: 768px) {
    body {
        padding-bottom: 70px;
    }

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

    .header-top {
        text-align: left;
    }

    header h1 {
        font-size: 1.5rem;
        text-align: center;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .form-card, .stats-card, .downloads-section {
        padding: 20px;
    }

    .download-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 1rem;
        min-height: 44px; /* Touch-friendly */
    }

    .btn-small {
        padding: 8px 16px;
        min-height: 36px;
    }

    #toastContainer {
        left: 20px;
        right: 20px;
        bottom: 90px;
    }

    .toast {
        min-width: auto;
    }

    .bottom-nav {
        display: flex;
    }

    .container {
        padding-bottom: 20px;
    }

    header {
        padding: 20px 15px;
        margin-bottom: 20px;
    }

    .add-download-section {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stats-card {
        padding: 15px;
    }

    .stat-item {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .section-header button {
        width: 100%;
    }

    .tabs-header {
        flex-direction: column;
        gap: 5px;
    }

    .tab-btn {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    .tab-label {
        font-size: 0.9rem;
    }

    .download-card {
        padding: 15px;
    }

    .download-meta {
        flex-direction: column;
        gap: 8px;
    }

    .modal-content {
        padding: 20px;
        margin: 10px;
        max-height: 85vh;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
        padding-bottom: 70px;
    }

    header h1 {
        font-size: 1.3rem;
    }

    .form-card h2 {
        font-size: 1.2rem;
    }

    .download-title {
        font-size: 1rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-light);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--surface-color);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--bg-color);
    transform: rotate(90deg);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal-actions .btn {
    width: auto;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 5px;
    font-weight: 400;
}

