/**
 * M3U Splitter - Simple & Modern UI
 * One-click download with category type detection
 */

/* ========================================
   Category Cards - Simple Design
   ======================================== */

.splitter-categories-simple {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.category-card-simple {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.category-card-simple:hover {
    border-color: #2196F3;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.15);
    transform: translateY(-2px);
}

.category-card-simple:active {
    transform: translateY(0);
}

/* Category Type Badge */
.category-type-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 20px;
}

/* Category Header */
.category-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.category-card-icon {
    font-size: 32px;
    line-height: 1;
}

.category-card-info {
    flex: 1;
    min-width: 0;
}

.category-card-name {
    font-size: 16px;
    font-weight: 600;
    color: #212121;
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-card-count {
    font-size: 14px;
    color: #757575;
}

/* Category Type Label */
.category-type-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 8px;
}

.category-type-label.type-live {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
}

.category-type-label.type-movie {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    color: #6a1b9a;
}

.category-type-label.type-series {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    color: #e65100;
}

.category-type-label.type-unknown {
    background: linear-gradient(135deg, #f5f5f5 0%, #eeeeee 100%);
    color: #616161;
}

/* Download Button */
.category-download-btn {
    width: 100%;
    padding: 10px;
    margin-top: 12px;
    background: linear-gradient(135deg, #42a5f5 0%, #1976d2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-download-btn:hover {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    box-shadow: 0 4px 8px rgba(25, 118, 210, 0.3);
}

.category-download-btn:active {
    transform: scale(0.98);
}

/* Recommendation Banner */
.category-recommendation {
    margin-top: 12px;
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
}

.recommendation-good {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 1px solid #81c784;
    color: #2e7d32;
}

.recommendation-info {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 1px solid #ffb74d;
    color: #e65100;
}

.recommendation-link {
    display: inline-block;
    margin-top: 6px;
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.recommendation-link:hover {
    text-decoration: none;
}

/* ========================================
   Filter & Sort Bar
   ======================================== */

.splitter-filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.splitter-search-box {
    flex: 1;
    min-width: 200px;
}

.splitter-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.splitter-search-input:focus {
    outline: none;
    border-color: #2196F3;
}

.splitter-type-filter {
    display: flex;
    gap: 8px;
}

.type-filter-btn {
    padding: 8px 14px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.type-filter-btn:hover {
    border-color: #2196F3;
    color: #2196F3;
}

.type-filter-btn.active {
    background: linear-gradient(135deg, #2196F3 0%, #1976d2 100%);
    border-color: #2196F3;
    color: white;
}

/* ========================================
   Stats Overview
   ======================================== */

.splitter-stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stats-overview-card {
    background: linear-gradient(135deg, #f5f5f5 0%, #eeeeee 100%);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}

.stats-overview-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.stats-overview-value {
    font-size: 24px;
    font-weight: 700;
    color: #212121;
    margin-bottom: 4px;
}

.stats-overview-label {
    font-size: 12px;
    color: #757575;
    text-transform: uppercase;
    font-weight: 600;
}

/* ========================================
   Advanced Mode Toggle
   ======================================== */

.splitter-mode-toggle {
    text-align: center;
    margin: 24px 0;
    padding: 16px;
    background: #f5f5f5;
    border-radius: 12px;
}

.mode-toggle-btn {
    padding: 10px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-toggle-btn:hover {
    border-color: #2196F3;
    color: #2196F3;
}

.splitter-advanced-section {
    display: none;
    margin-top: 20px;
    padding: 20px;
    background: #fafafa;
    border-radius: 12px;
    border: 2px dashed #e0e0e0;
}

.splitter-advanced-section.visible {
    display: block;
}

/* ========================================
   Loading States
   ======================================== */

.category-card-simple.downloading {
    pointer-events: none;
    opacity: 0.6;
}

.category-download-btn.loading {
    background: #9e9e9e;
    cursor: not-allowed;
}

.category-download-btn.loading::after {
    content: " ⏳";
}

/* ========================================
   Mobile Responsive
   ======================================== */

@media (max-width: 768px) {
    .splitter-categories-simple {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .category-card-simple {
        padding: 14px;
    }
    
    .category-card-icon {
        font-size: 28px;
    }
    
    .category-card-name {
        font-size: 15px;
    }
    
    .splitter-filter-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .splitter-search-box,
    .splitter-type-filter {
        width: 100%;
    }
    
    .splitter-type-filter {
        flex-wrap: wrap;
    }
    
    .type-filter-btn {
        flex: 1;
        min-width: calc(50% - 4px);
    }
}

@media (max-width: 480px) {
    .splitter-stats-overview {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-overview-value {
        font-size: 20px;
    }
    
    .category-recommendation {
        font-size: 11px;
    }
}

/* ========================================
   Empty State
   ======================================== */

.splitter-empty-state {
    text-align: center;
    padding: 60px 20px;
}

.splitter-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.splitter-empty-text {
    font-size: 18px;
    color: #757575;
    margin-bottom: 8px;
}

.splitter-empty-hint {
    font-size: 14px;
    color: #9e9e9e;
}

/* ========================================
   Animations
   ======================================== */

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

.category-card-simple {
    animation: fadeIn 0.3s ease;
}

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

.category-download-btn.loading {
    animation: pulse 1.5s infinite;
}

/* ========================================
   Quick downloads (M3U splitter one-click exports)
   ======================================== */

.splitter-quick-downloads {
    margin: 16px 0 20px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 55%);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.splitter-quick-downloads__head {
    margin-bottom: 14px;
}

.splitter-quick-downloads__kicker {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 4px;
}

.splitter-quick-downloads__title {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.splitter-quick-downloads__lead {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: #475569;
    max-width: 65ch;
}

.splitter-quick-downloads__subsection {
    margin-top: 12px;
}

.splitter-quick-downloads__subsection:first-of-type {
    margin-top: 0;
}

.splitter-quick-downloads__sub {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}

.splitter-quick-downloads__subsection--adult .splitter-quick-downloads__sub {
    color: #9f1239;
}

.splitter-quick-downloads__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.splitter-quick-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 12px;
    margin: 0;
    text-align: left;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.splitter-quick-btn:hover:not(:disabled) {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.12);
}

.splitter-quick-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.splitter-quick-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    background: #f1f5f9;
}

.splitter-quick-btn__label {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.splitter-quick-btn--adult .splitter-quick-btn__label {
    color: #881337;
}

.splitter-quick-btn__file {
    font-size: 11px;
    color: #64748b;
    word-break: break-all;
    line-height: 1.3;
}

.splitter-quick-btn__meta {
    font-size: 12px;
    color: #475569;
    margin-top: 2px;
}

.splitter-quick-btn__meta strong {
    color: #0f172a;
    font-weight: 700;
}

@media (max-width: 900px) {
    .splitter-quick-downloads__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .splitter-quick-downloads {
        padding: 12px;
    }

    .splitter-quick-downloads__grid {
        grid-template-columns: 1fr;
    }

    .splitter-quick-btn {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        column-gap: 10px;
    }

    .splitter-quick-btn__label {
        flex: 1 1 auto;
        min-width: 0;
    }

    .splitter-quick-btn__meta {
        width: 100%;
        margin-top: 0;
    }
}

/* Workflow steps */
.splitter-workflow-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    justify-content: center;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.splitter-workflow-steps li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted, #64748b);
}

.splitter-workflow-steps__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #7c3aed, #db2777);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

.splitter-quick-downloads__note {
    margin: 10px 0 0;
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
}

.splitter-quick-downloads__note a {
    color: #7c3aed;
    font-weight: 600;
}

.splitter-quick-btn[hidden] {
    display: none !important;
}

.splitter-export-actions {
    flex-wrap: wrap;
    gap: 10px;
}

.splitter-guest-save-hint {
    margin-top: 10px;
    font-size: 0.88rem;
    color: var(--text-muted, #64748b);
}

.splitter-save-success {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(124, 58, 237, 0.25);
    background: rgba(124, 58, 237, 0.06);
}

.splitter-save-success p {
    margin: 0 0 10px;
    font-weight: 600;
}

.splitter-class-debug {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin: 12px 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 12px;
    font-family: ui-monospace, monospace;
}

.category-type-filter .type-filter-btn[hidden] {
    display: none;
}

@media (max-width: 640px) {
    .splitter-workflow-steps {
        flex-direction: column;
        align-items: flex-start;
    }

    .category-type-filter {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }
}
