/* Ohm Streaming - Premium Dark Theme */
:root {
    --bg-dark: #0b0b14;
    --bg-card: #161625;
    --primary: #00d9ff;
    --primary-hover: #00b8d9;
    --primary-glow: rgba(0, 217, 255, 0.3);
    --secondary: #ff6b6b;
    --secondary-hover: #e55a5a;
    --text-main: #ffffff;
    --text-dim: #a0a0b0;
    --accent: #00ff88;
    --danger: #ff4d4d;
    --card-radius: 12px;
    --input-radius: 8px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

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

@media (max-width: 768px) {
    .container { padding: 0 20px; }
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 5px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-dim);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

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

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    border-left: 4px solid var(--primary);
    padding-left: 15px;
}

/* Global Button System */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--input-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
    color: #fff;
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--primary);
    color: #000;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 0 15px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-accent {
    background: var(--accent);
    color: #000;
}

.btn-danger {
    background: rgba(255, 77, 77, 0.15);
    border-color: rgba(255, 77, 77, 0.3);
    color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger);
    color: #fff;
}

.btn-small, .btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.75rem;
}

.btn-large {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    padding: 0;
    font-size: 1.2rem;
}

/* Legacy class mapping for compatibility */
.btn-card {
    padding: 8px 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.btn-watch { background: var(--primary); color: #000; }
.btn-download { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); color: #fff; }

/* Horizontal Scroll Row (Homepage) */
.home-row, .streaming-row, .recommendations-carousel, .releases-carousel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 10px 0 20px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.home-row::-webkit-scrollbar, .streaming-row::-webkit-scrollbar, .recommendations-carousel::-webkit-scrollbar, .releases-carousel::-webkit-scrollbar {
    height: 4px;
}
.home-row::-webkit-scrollbar-thumb, .streaming-row::-webkit-scrollbar-thumb, .recommendations-carousel::-webkit-scrollbar-thumb, .releases-carousel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
.home-row::-webkit-scrollbar-thumb:hover, .streaming-row::-webkit-scrollbar-thumb:hover, .recommendations-carousel::-webkit-scrollbar-thumb:hover, .releases-carousel::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Home Card */
.hc {
    flex: 0 0 180px;
    display: block;
    background: var(--bg-card);
    border-radius: var(--card-radius);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-decoration: none;
    color: inherit;
}
.hc:hover {
    transform: scale(1.08);
    z-index: 10;
    border-color: var(--primary);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}
.hc-poster {
    position: relative;
    padding-top: 150%;
    background: #000;
}
.hc-poster img {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
}
.hc-rating {
    position: absolute;
    top: 8px; right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: #ffcc00;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
}
.hc-play {
    position: absolute;
    bottom: 8px; right: 8px;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    opacity: 0;
    transition: var(--transition);
}
.hc:hover .hc-play { opacity: 1; }
.hc-info {
    padding: 10px;
}
.hc-src {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 2px;
}
.hc-title {
    font-size: 0.82rem;
    font-weight: 600;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}

/* Responsive Grid for Search */
.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

/* Tabs UI */
.tabs {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 30px;
    overflow-x: auto;
}

.tab {
    padding: 15px 10px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.tab svg {
    width: 18px;
    height: 18px;
}

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

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

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0; width: 100%;
    height: 3px;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Modern Forms & Input Groups */
.input-group {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--card-radius);
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: var(--transition);
}

.input-group:focus-within {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 15px rgba(0, 217, 255, 0.1);
}

.input-group input {
    background: none;
    border: none;
    padding: 10px 15px;
    color: #fff;
    flex-grow: 1;
    font-size: 1rem;
}

.input-group input:focus { outline: none; }

.btn-search {
    padding: 0 25px;
}

/* Auth Section UI */
.auth-panel {
    margin-bottom: 25px;
    padding: 15px 20px;
    background: linear-gradient(90deg, rgba(0, 217, 255, 0.1), transparent);
    border: 1px solid rgba(0, 217, 255, 0.15);
    border-radius: var(--card-radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-container {
    max-width: 450px;
    margin: 80px auto;
    padding: 40px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.auth-title {
    text-align: center;
    margin-bottom: 30px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-tab {
    flex: 1;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    color: var(--text-dim);
    transition: var(--transition);
    font-weight: 600;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--input-radius);
    color: #fff;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.2);
}

.auth-error, .auth-success {
    padding: 12px 15px;
    border-radius: var(--input-radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: none;
}

.auth-error {
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: var(--danger);
}

.auth-success {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: var(--accent);
}

.show { display: block !important; }

/* Progress Bars */
.progress-container {
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    margin: 10px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.3s ease;
}

/* Icon Buttons */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon.danger {
    color: var(--danger);
}

.btn-icon.danger:hover {
    background: rgba(255, 77, 77, 0.15);
    border-color: rgba(255, 77, 77, 0.3);
}

.btn-icon.success {
    color: var(--accent);
}

.btn-icon.success:hover {
    background: rgba(0, 255, 136, 0.15);
    border-color: rgba(0, 255, 136, 0.3);
}

/* Download Items */
.downloads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.download-item {
    background: var(--bg-card);
    border-radius: var(--card-radius);
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.download-item:hover {
    border-color: var(--primary);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

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

.download-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.download-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-dim);
}

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

/* Badge System Enhancements */
.badge-completed { color: var(--accent); background: rgba(0, 255, 136, 0.1); }
.badge-failed { color: var(--danger); background: rgba(255, 77, 77, 0.1); }
.badge-downloading { color: var(--primary); background: rgba(0, 217, 255, 0.1); }
.badge-paused { color: #ffcc00; background: rgba(255, 204, 0, 0.1); }

/* Loading Spinners & Empty States */
.loading-placeholder, .loading-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-dim);
    gap: 15px;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0, 217, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state, .no-results {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-dim);
}

.empty-state i, .no-results i {
    font-size: 3.5rem;
    margin-bottom: 20px;
    display: block;
    opacity: 0.15;
}

.htmx-indicator { display: none; }
.htmx-indicator.htmx-request { display: flex; align-items: center; gap: 8px; }

/* Section Containers */
.section-container {
    margin-bottom: 50px;
}

@media (max-width: 768px) {
    .anime-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
    .hc { flex: 0 0 140px; }
    .tabs { gap: 10px; }
    .auth-panel { flex-direction: column; gap: 15px; text-align: center; }
}

/* Alerts & Toasts */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
}

.toast {
    padding: 15px 25px;
    background: var(--bg-card);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    margin-top: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideIn 0.3s ease-out;
}

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

/* ==================== Download Items ==================== */
.download-item {
    padding: 15px 18px;
    background: var(--bg-card);
    border-radius: var(--card-radius);
    border-left: 4px solid var(--text-dim);
    margin-bottom: 10px;
    transition: var(--transition);
}

.download-item:hover {
    border-color: var(--primary);
    transform: translateX(3px);
}

.download-item.status-downloading {
    border-left-color: var(--primary);
    animation: pulse-border 2s ease-in-out infinite;
}

.download-item.status-completed {
    border-left-color: var(--accent);
}

.download-item.status-failed,
.download-item.status-cancelled {
    border-left-color: var(--danger);
}

.download-item.status-paused {
    border-left-color: #f0a500;
}

.download-item.status-pending {
    border-left-color: var(--text-dim);
}

@keyframes pulse-border {
    0%, 100% { border-left-color: var(--primary); }
    50% { border-left-color: rgba(0, 217, 255, 0.3); }
}

/* Progress bar shimmer */
.download-item.status-downloading .progress-bar {
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 50%, var(--primary) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Download action buttons */
.download-actions .btn-icon.warning {
    color: #f0a500;
}
.download-actions .btn-icon.warning:hover {
    background: rgba(240, 165, 0, 0.2);
}
