/**
 * M3U8文件分析器样式表
 * 
 * @author M3U8 Analyzer
 * @version 1.0.0
 */

:root {
    --primary-color: #4a90d9;
    --primary-hover: #357abd;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

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

.header {
    text-align: center;
    padding: 40px 20px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.input-section {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    gap: 15px;
}

.input-group input {
    flex: 1;
    padding: 15px 20px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    outline: none;
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.2);
}

.input-group button {
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.input-group button:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    transform: none;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

.error-section {
    margin-bottom: 30px;
}

.error-box {
    background: #fff;
    border-left: 4px solid var(--danger-color);
    padding: 20px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow);
}

.error-icon {
    font-size: 24px;
}

.error-text {
    color: var(--danger-color);
    font-weight: 500;
}

.result-section {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

.summary-box {
    margin-bottom: 30px;
}

.summary-box h2 {
    color: var(--dark-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.summary-item {
    background: var(--light-color);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
}

.summary-item .label {
    display: block;
    font-size: 14px;
    color: var(--secondary-color);
    margin-bottom: 8px;
}

.summary-item .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.summary-item .value.encrypted {
    color: var(--warning-color);
}

.summary-item .value.unencrypted {
    color: var(--success-color);
}

.playlists-info {
    background: #e3f2fd;
    padding: 20px;
    border-radius: var(--radius);
    margin-top: 20px;
}

.playlists-info h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.playlists-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.playlist-item {
    background: white;
    padding: 12px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.playlist-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(74, 144, 217, 0.2);
}

.pl-bandwidth, .pl-resolution {
    font-size: 12px;
    color: var(--secondary-color);
    background: var(--light-color);
    padding: 3px 8px;
    border-radius: 4px;
}

.encryption-info {
    background: #fff3cd;
    padding: 20px;
    border-radius: var(--radius);
    margin-top: 20px;
}

.encryption-info h3 {
    color: #856404;
    margin-bottom: 15px;
}

.encryption-details p {
    margin: 8px 0;
    color: #856404;
}

.actions-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 10px 20px;
    font-size: 14px;
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.ts-list-section h2 {
    color: var(--dark-color);
    margin-bottom: 20px;
}

.list-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.list-controls input {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    outline: none;
}

.list-controls input:focus {
    border-color: var(--primary-color);
}

.list-controls select {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
}

.ts-table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.ts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.ts-table th,
.ts-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.ts-table th {
    background: var(--light-color);
    font-weight: 600;
    color: var(--dark-color);
    position: sticky;
    top: 0;
}

.ts-table tbody tr:hover {
    background: #f5f5f5;
}

.ts-table .col-seq {
    width: 60px;
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
}

.ts-table .col-time {
    width: 85px;
    text-align: center;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
}

.ts-table .col-time.start-time {
    color: var(--success-color);
    font-weight: 600;
}

.ts-table .col-time.end-time {
    color: var(--info-color);
}

.ts-table .col-filename {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ts-table .col-duration {
    width: 80px;
    text-align: center;
    color: var(--secondary-color);
}

.ts-table .col-url {
    max-width: 300px;
}

.ts-table .col-url a {
    color: var(--primary-color);
    text-decoration: none;
}

.ts-table .col-url a:hover {
    text-decoration: underline;
}

.ts-table .col-actions {
    width: 100px;
    text-align: center;
}

.ts-table .col-actions button,
.ts-table .col-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0 3px;
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.ts-table .col-actions button:hover,
.ts-table .col-actions a:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.tag-discontinuity {
    margin-left: 5px;
    font-size: 12px;
}

.ts-table.compact-view tbody tr {
    display: block;
    float: left;
    width: calc(25% - 10px);
    margin: 5px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 10px;
}

.ts-table.compact-view tbody tr:hover {
    background: #f5f5f5;
}

.ts-table.compact-view td {
    display: block;
    border: none;
    padding: 5px 0;
}

.ts-table.compact-view .col-seq::before {
    content: '#';
}

.ts-table.compact-view .col-url,
.ts-table.compact-view .col-actions {
    display: none;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

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

.page-info {
    color: var(--secondary-color);
    font-size: 14px;
}

.notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--dark-color);
    color: white;
    padding: 15px 25px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
    z-index: 1000;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.footer {
    text-align: center;
    padding: 30px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

/* 广告分析样式 */
.ad-analysis-box {
    background: #fff3cd;
    padding: 20px;
    border-radius: var(--radius);
    margin-top: 20px;
    border: 1px solid #ffc107;
}

.ad-analysis-box h3 {
    color: #856404;
    margin-bottom: 10px;
}

.ad-summary {
    color: #856404;
    margin-bottom: 15px;
    font-weight: 500;
}

.ad-ranges-summary {
    background: white;
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 15px;
    border: 2px dashed #ffc107;
}

.ad-ranges-summary strong {
    color: #856404;
}

.ad-range-tag {
    display: inline-block;
    background: #dc3545;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    margin: 3px;
    font-weight: 600;
    font-size: 14px;
}

.ad-range-badge {
    background: #ffc107;
    color: #856404;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.ad-segments-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ad-segment-item {
    background: white;
    border-radius: var(--radius);
    padding: 15px;
    border-left: 4px solid #ffc107;
}

.ad-segment-item.confidence-high {
    border-left-color: #dc3545;
    background: #f8d7da;
}

.ad-segment-item.confidence-medium {
    border-left-color: #ffc107;
    background: #fff3cd;
}

.ad-segment-item.confidence-low {
    border-left-color: #17a2b8;
    background: #d1ecf1;
}

.ad-segment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.ad-badge {
    background: #dc3545;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.ad-confidence {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 500;
}

.ad-confidence.confidence-high {
    background: #dc3545;
    color: white;
}

.ad-confidence.confidence-medium {
    background: #ffc107;
    color: #856404;
}

.ad-confidence.confidence-low {
    background: #17a2b8;
    color: white;
}

.ad-segment-details {
    font-size: 13px;
}

.ad-segment-details p {
    margin: 5px 0;
    color: #856404;
}

/* TS表格广告标记样式 */
.ad-row {
    background: #fff3cd !important;
}

.ad-row.confidence-high {
    background: #f8d7da !important;
}

.ad-row.confidence-medium {
    background: #fff3cd !important;
}

.ad-row.confidence-low {
    background: #d1ecf1 !important;
}

.ad-row:hover {
    background: #ffeaa7 !important;
}

.ad-marker {
    margin-left: 5px;
    font-size: 14px;
    cursor: help;
}

.ad-label {
    display: inline-block;
    background: #dc3545;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 5px;
    font-weight: 600;
}

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

    .header h1 {
        font-size: 1.8rem;
    }

    .input-group {
        flex-direction: column;
    }

    .input-group button {
        width: 100%;
        justify-content: center;
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ts-table .col-url {
        display: none;
    }

    .ts-table.compact-view tbody tr {
        width: calc(50% - 10px);
    }
}

@media (max-width: 480px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

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

    .action-btn {
        width: 100%;
        text-align: center;
    }

    .ts-table.compact-view tbody tr {
        width: 100%;
        margin: 5px 0;
    }
}
