/* css/style.css */

:root {
    --primary-color: #ff0000;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #0f0f0f;
    --text-secondary: #606060;
    --border-color: #e5e5e5;
    --error-bg: #ffeef0;
    --error-text: #d93025;
    --success-bg: #e6f4ea;
    --success-text: #137333;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 10px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: var(--primary-color);
    margin-bottom: 8px;
}

header p {
    color: var(--text-secondary);
    margin: 0;
}

/* Navegación por pestañas */
.tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.tab-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s ease;
    font-weight: 500;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    font-weight: bold;
    box-shadow: 0 -3px 6px rgba(0,0,0,0.1);
}

.tab-btn:hover:not(.active) {
    background: #e9ecef;
    color: #000;
}

/* Vistas */
.view-section {
    display: none;
    animation: fadeIn 0.3s;
}

.view-section:not(.hidden) {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Formularios y Filtros */
.search-box, .history-box {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 15px;
    box-sizing: border-box;
    outline: none;
    resize: vertical;
    margin-bottom: 15px;
}

textarea:focus {
    border-color: var(--primary-color);
}

.filters-panel {
    background: #f1f3f4;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    font-size: 13px;
    font-weight: bold;
    color: #444;
}

.filter-group input, .filter-group select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    font-weight: bold;
    transition: filter 0.2s;
}

button:hover {
    filter: brightness(0.9);
}

/* Estados */
#loading {
    text-align: center;
    padding: 20px;
    font-weight: 500;
    color: var(--text-secondary);
}

#error {
    background-color: var(--error-bg);
    color: var(--error-text);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 25px;
    border: 1px solid #fad2cf;
    font-size: 14px;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Tarjetas */
.channel-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.local-card {
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.local-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.channel-header {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 24px;
}

.channel-card img.avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.channel-info h2 {
    margin: 0 0 6px 0;
    font-size: 22px;
}

.channel-info p.custom-url {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0 0 8px 0;
    font-weight: 500;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #000;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-top: 6px;
    letter-spacing: 0.5px;
}

/* Videos Grid */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.video-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
}

.video-card:hover {
    transform: translateY(-2px);
}

.video-card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.video-content {
    padding: 12px;
}

.video-title {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-date {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Tabla */
.table-container {
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    vertical-align: middle;
}

th {
    background-color: #f1f3f4;
    color: var(--text-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
}

tr:hover td {
    background-color: #f8f9fa;
}

th:last-child, td:last-child {
    text-align: right;
    font-weight: 500;
}

.table-thumb {
    width: 90px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    display: block;
}

/* Botón de borrado */
.delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    color: var(--error-text);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
    padding: 0;
    opacity: 0.7;
}

.delete-btn:hover {
    background: transparent;
    color: var(--error-text);
    opacity: 1;
    transform: scale(1.2);
}

/* Cabeceras ordenables e indicador */
.sortable-header {
    position: relative;
    transition: background-color 0.2s, color 0.2s;
}

.sortable-header:hover {
    background-color: #e8eaed;
    color: var(--primary-color);
}

.sort-indicator {
    display: inline-block;
    margin-left: 4px;
    font-size: 11px;
    opacity: 0.5;
    vertical-align: middle;
}

.sortable-header.asc .sort-indicator::before {
    content: "▲";
}

.sortable-header.desc .sort-indicator::before {
    content: "▼";
}

.sortable-header:not(.asc):not(.desc) .sort-indicator::before {
    content: "↕";
}

/* Input de búsqueda de la tabla */
#tableSearch:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.1);
}

/* Paginación */
.pagination-container {
    background: var(--card-bg);
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.pagination-btn {
    background-color: #f1f3f4;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #e8eaed;
    border-color: #ccc;
}

.pagination-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}