/* ============================================================
   LYCOSTORRENT - Style de l'application de recherche
   ============================================================ */

/* Variables par défaut (utilisées si aucun thème n'est défini) */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1f2940;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --accent-primary: #e94560;
    --accent-secondary: #0f3460;
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #ef4444;
    --border-color: #2d3748;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --radius: 8px;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    color: var(--accent-primary);
    margin-bottom: 5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Navigation */
.main-nav {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.main-nav a {
    padding: 10px 25px;
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

.main-nav a:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.main-nav a.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.main-nav a.nav-logout {
    background: transparent;
    border-color: var(--danger);
    color: var(--danger);
    padding: 10px 15px;
}

.main-nav a.nav-logout:hover {
    background: var(--danger);
    color: white;
}

/* ============================================================
   SEARCH SECTION
   ============================================================ */

.search-section {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#search-input {
    flex: 1;
    padding: 14px 18px;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

#search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

#search-input::placeholder {
    color: var(--text-secondary);
}

.btn-primary {
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover {
    background: #d63050;
    transform: translateY(-1px);
}

.btn-secondary {
    padding: 8px 16px;
    font-size: 0.9rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-card);
}

/* Search options */
.search-options {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.option-group {
    flex: 1;
    min-width: 200px;
}

.option-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

#category-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
}

#category-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* ============================================================
   TRACKERS SELECTOR (style Nouveautés)
   ============================================================ */

.trackers-selector {
    margin-top: 20px;
}

.toggle-btn {
    padding: 10px 20px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.toggle-btn:hover {
    border-color: var(--accent-primary);
}

.trackers-panel {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-card);
    border-radius: var(--radius);
}

.trackers-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.trackers-actions button {
    padding: 8px 15px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.trackers-actions button:hover {
    border-color: var(--accent-primary);
}

.trackers-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tracker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    transition: border-color 0.2s;
}

.tracker-item:hover {
    border-color: var(--accent-primary);
}

.tracker-item input {
    accent-color: var(--accent-primary);
}

.tracker-item label {
    cursor: pointer;
    font-size: 0.9rem;
}

/* Legacy - garder pour compatibilité */
.trackers-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tracker-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s;
}

.tracker-checkbox:hover {
    border-color: var(--accent-primary);
}

.tracker-checkbox input {
    accent-color: var(--accent-primary);
    width: 16px;
    height: 16px;
}

.tracker-name {
    flex: 1;
}

/* Badges de source (Jackett/Prowlarr) */
.source-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.source-jackett {
    background: #3b82f6;
    color: white;
}

.source-prowlarr {
    background: #f59e0b;
    color: #1a1a2e;
}

.source-both {
    background: linear-gradient(135deg, #3b82f6 50%, #f59e0b 50%);
    color: white;
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
}

/* ============================================================
   FILTERS SECTION
   ============================================================ */

.filters-section {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.filters-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.btn-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 5px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-toggle:hover {
    border-color: var(--accent-primary);
}

.btn-toggle.collapsed {
    transform: rotate(-90deg);
}

.filters-content {
    transition: all 0.3s ease;
}

.filters-content.collapsed {
    display: none;
}

.filters-section h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.results-count {
    font-weight: normal;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.filter-group {
    background: var(--bg-card);
    padding: 15px;
    border-radius: var(--radius);
    min-width: 180px;
}

.filter-group h4 {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: var(--accent-primary);
}

.filter-values {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    cursor: pointer;
    font-size: 0.9rem;
}

.filter-checkbox input {
    accent-color: var(--accent-primary);
    width: 14px;
    height: 14px;
}

.filter-label {
    color: var(--text-primary);
}

.filter-count {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* ============================================================
   RESULTS SECTION
   ============================================================ */

.results-section {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.placeholder-text,
.no-results {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    font-size: 1.1rem;
}

/* Results table */
.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th {
    text-align: left;
    padding: 12px 10px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-color);
}

.results-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.results-table tr:hover {
    background: var(--bg-card);
}

/* Column widths */
.col-name { width: 50%; }
.col-tracker { width: 12%; }
.col-size { width: 10%; }
.col-seeders { width: 8%; text-align: center; }
.col-date { width: 12%; }
.col-actions { width: 8%; text-align: center; }

/* Torrent title and badges */
.torrent-title {
    font-weight: 500;
    word-break: break-word;
    margin-bottom: 6px;
}

.torrent-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-quality {
    background: #3b82f6;
    color: white;
}

.badge-source {
    background: #8b5cf6;
    color: white;
}

.badge-codec {
    background: #06b6d4;
    color: white;
}

.badge-language {
    background: #22c55e;
    color: white;
}

.badge-hdr {
    background: #f59e0b;
    color: black;
}

/* Seeders colors */
.seeders-none { color: var(--danger); }
.seeders-low { color: var(--warning); }
.seeders-medium { color: var(--text-primary); }
.seeders-high { color: var(--success); font-weight: 600; }

/* Action buttons */
.btn-magnet,
.btn-download,
.btn-details {
    display: inline-block;
    padding: 6px;
    font-size: 1.1rem;
    text-decoration: none;
    transition: transform 0.1s;
}

.btn-magnet:hover,
.btn-download:hover,
.btn-details:hover {
    transform: scale(1.2);
}

/* ============================================================
   LOADING OVERLAY
   ============================================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   UTILITIES
   ============================================================ */

.hidden {
    display: none !important;
}

.loading {
    color: var(--text-secondary);
    font-style: italic;
}

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    flex-wrap: wrap;
    gap: 10px;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 8px 12px;
    font-size: 0.9rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    font-weight: 600;
}

.pagination-ellipsis {
    padding: 8px 5px;
    color: var(--text-secondary);
}

/* ============================================================
   SORTABLE HEADERS
   ============================================================ */

.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.sortable:hover {
    color: var(--accent-primary);
}

.sort-icon {
    margin-left: 5px;
    opacity: 0.4;
    font-size: 0.8rem;
}

.sort-icon.active {
    opacity: 1;
    color: var(--accent-primary);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablette */
@media (max-width: 1024px) {
    .container {
        padding: 15px;
    }
    
    .search-options {
        gap: 20px;
    }
    
    .filter-group {
        min-width: 150px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.6rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }

    /* Navigation mobile */
    .main-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
    
    .main-nav a {
        padding: 8px 15px;
        font-size: 0.85rem;
        flex: 1 1 auto;
        text-align: center;
        min-width: 80px;
        max-width: 150px;
    }
    
    /* Logout séparé */
    .main-nav a.nav-logout {
        flex: 0 0 auto;
        min-width: 50px;
        max-width: 50px;
        padding: 8px 12px;
    }

    /* Search section */
    .search-section {
        padding: 15px;
    }

    .search-bar {
        flex-direction: column;
    }

    #search-input {
        font-size: 1rem;
        padding: 12px 15px;
    }

    .btn-primary {
        width: 100%;
        padding: 12px;
    }

    .search-options {
        flex-direction: column;
        gap: 15px;
    }
    
    .option-group {
        min-width: 100%;
    }

    /* Trackers */
    .trackers-checkboxes {
        gap: 8px;
    }
    
    .tracker-checkbox {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    /* Filters */
    .filters-section {
        padding: 15px;
    }

    .filters-container {
        flex-direction: column;
        gap: 10px;
    }

    .filter-group {
        width: 100%;
        min-width: 100%;
        padding: 12px;
    }
    
    .filter-values {
        max-height: 150px;
    }

    /* Results - mode cards sur mobile */
    .results-section {
        padding: 10px;
    }
    
    .results-table {
        display: none;
    }
    
    .results-cards {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    /* Card mobile pour les résultats */
    .result-card-mobile {
        background: var(--bg-card);
        padding: 12px;
        border-radius: var(--radius);
        border-left: 3px solid var(--accent-primary);
    }
    
    .result-card-mobile .torrent-title {
        font-size: 0.9rem;
        font-weight: 600;
        margin-bottom: 8px;
        line-height: 1.3;
    }
    
    .result-card-mobile .torrent-badges {
        margin-bottom: 10px;
    }
    
    .result-card-mobile .result-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        font-size: 0.8rem;
        color: var(--text-secondary);
        margin-bottom: 10px;
    }
    
    .result-card-mobile .result-meta span {
        display: flex;
        align-items: center;
        gap: 4px;
    }
    
    .result-card-mobile .result-actions {
        display: flex;
        gap: 8px;
    }
    
    .result-card-mobile .result-actions a {
        flex: 1;
        text-align: center;
        padding: 10px;
        border-radius: var(--radius);
        text-decoration: none;
        font-size: 1.1rem;
    }
    
    .result-card-mobile .btn-magnet-mobile {
        background: var(--accent-primary);
        color: white;
    }
    
    .result-card-mobile .btn-download-mobile {
        background: var(--success);
        color: white;
    }
    
    .result-card-mobile .btn-details-mobile {
        background: var(--accent-secondary);
        color: white;
    }

    /* Pagination */
    .pagination {
        flex-direction: column;
        gap: 15px;
    }
    
    .pagination-controls {
        justify-content: center;
    }
    
    .pagination-btn {
        padding: 10px 14px;
    }
}

/* Très petit écran */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.4rem;
    }
    
    .main-nav {
        gap: 6px;
    }
    
    .main-nav a {
        padding: 8px 10px;
        font-size: 0.8rem;
        min-width: 70px;
    }
    
    .main-nav a.nav-logout {
        min-width: 40px;
        max-width: 40px;
        padding: 8px;
    }
    
    .badge {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
    
    .source-badge {
        font-size: 0.55rem;
        padding: 1px 4px;
    }
}

/* RSS Source Badge */
.source-badge.source-rss {
    background: #10b981;
    color: white;
}

/* ============================================================
   FOOTER
   ============================================================ */

.app-footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
}

.app-footer a {
    color: var(--accent-primary);
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* ============================================================
   BOUTON ENVOYER AU CLIENT TORRENT
   ============================================================ */

.btn-send-client,
.btn-send-client-mobile {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-send-client:hover,
.btn-send-client-mobile:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.4);
}

.btn-send-client:disabled,
.btn-send-client-mobile:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    transition: opacity 0.3s, transform 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    pointer-events: none;
}

.toast.success {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

.toast.error {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
}

.toast.info {
    background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
}

.toast.warning {
    background: linear-gradient(135deg, #d35400 0%, #e67e22 100%);
}

/* ============================================================
   MODAL OPTIONS TORRENT
   ============================================================ */

.torrent-options-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.torrent-options-modal.visible {
    opacity: 1;
    visibility: visible;
}

.torrent-options-content {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 25px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.torrent-options-content h3 {
    margin: 0 0 20px 0;
    color: var(--accent-primary);
    font-size: 1.2rem;
}

.torrent-option-group {
    margin-bottom: 15px;
}

.torrent-option-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.torrent-option-group select,
.torrent-option-group input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    box-sizing: border-box;
}

.torrent-option-group select:focus,
.torrent-option-group input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.torrent-option-group.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.torrent-option-group.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
}

.torrent-option-group.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.torrent-options-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.torrent-options-buttons button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.torrent-options-buttons .btn-cancel {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.torrent-options-buttons .btn-cancel:hover {
    background: var(--bg-card);
}

.torrent-options-buttons .btn-confirm {
    background: var(--success);
    color: white;
}

.torrent-options-buttons .btn-confirm:hover {
    background: #22b547;
}