* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-red: #8B0000;
    --dark-gray: #2c2c2c;
    --medium-gray: #666;
    --light-gray: #e0e0e0;
    --bg-gray: #f5f5f5;
    --white: #ffffff;
    --green: #4CAF50;
    --red: #f44336;
    --yellow: #FFC107;
}

body {
    font-family: Arial, sans-serif;
    background: var(--bg-gray);
    color: var(--dark-gray);
}

.dashboard-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.dashboard-header h1 {
    font-size: 1.8em;
    color: var(--dark-gray);
}

.header-search input {
    padding: 10px 15px;
    border: 1px solid var(--light-gray);
    border-radius: 20px;
    width: 300px;
    font-size: 0.95em;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    border-radius: 15px;
    padding: 25px;
    color: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.metric-card.primary {
    background: linear-gradient(135deg, var(--primary-red) 0%, #A52A2A 100%);
}

.metric-card.secondary {
    background: linear-gradient(135deg, #757575 0%, #9E9E9E 100%);
}

.metric-card.dark {
    background: linear-gradient(135deg, #424242 0%, #212121 100%);
}

.metric-label {
    font-size: 0.85em;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 15px;
    opacity: 0.9;
}

.metric-value {
    font-size: 3em;
    font-weight: bold;
    margin-bottom: 10px;
}

.metric-change {
    font-size: 0.9em;
    opacity: 0.9;
}

.metric-change.positive::before {
    content: '↑';
    margin-right: 5px;
}

/* Thumbs Up/Down */
.metric-thumbs {
    display: flex;
    gap: 20px;
    align-items: center;
}

.thumb-up, .thumb-down {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.1);
    padding: 15px 20px;
    border-radius: 10px;
    flex: 1;
}

.thumb-up {
    background: rgba(76, 175, 80, 0.3);
}

.thumb-down {
    background: rgba(244, 67, 54, 0.3);
}

.icon {
    font-size: 2em;
    margin-bottom: 5px;
}

.thumb-value {
    font-size: 1.5em;
    font-weight: bold;
}

.thumb-percent {
    font-size: 0.9em;
    opacity: 0.8;
}

/* Device Info */
.metric-device {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.1);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9em;
}

.device-icon {
    font-size: 1.5em;
}

.device-label {
    font-weight: bold;
}

/* Table Controls */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-select-all {
    background: var(--primary-red);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-select-all:hover {
    background: #A52A2A;
    transform: translateY(-2px);
}

.table-search {
    flex: 1;
    min-width: 200px;
}

.table-search input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--light-gray);
    border-radius: 20px;
    font-size: 0.95em;
}

.table-actions {
    display: flex;
    gap: 10px;
}

.btn-action, .btn-add-new {
    padding: 10px 25px;
    border-radius: 25px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-action {
    background: var(--dark-gray);
    color: white;
}

.btn-add-new {
    background: var(--primary-red);
    color: white;
}

.btn-action:hover, .btn-add-new:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Table */
.stores-table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.stores-table {
    width: 100%;
    border-collapse: collapse;
}

.stores-table thead {
    background: var(--primary-red);
    color: white;
}

.stores-table th {
    padding: 15px 10px;
    text-align: left;
    font-weight: bold;
    font-size: 0.85em;
    line-height: 1.3;
}

.stores-table tbody tr {
    border-bottom: 1px solid var(--light-gray);
    transition: background 0.2s ease;
}

.stores-table tbody tr:hover {
    background: #f9f9f9;
}

.stores-table tbody tr.store-row {
    cursor: pointer;
}

.stores-table tbody tr.store-row.expanded {
    background: #e3f2fd;
    border-left: 4px solid var(--primary-red);
}

.stores-table tbody tr.store-details-row {
    background: #f8f9fa;
}

.stores-table tbody tr.store-details-row td {
    padding: 0;
}

.store-details-container {
    padding: 30px;
    background: white;
    border-radius: 8px;
    margin: 10px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.05);
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-gray);
}

.details-header h3 {
    font-size: 1.3em;
    color: var(--dark-gray);
}

.btn-close {
    background: var(--red);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    transition: all 0.3s ease;
}

.btn-close:hover {
    background: #d32f2f;
    transform: scale(1.05);
}

.tv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.loading-tvs,
.no-data,
.error-message {
    text-align: center;
    padding: 40px;
    color: var(--medium-gray);
    font-size: 1.1em;
}

.tv-card {
    background: white;
    border: 2px solid var(--light-gray);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.tv-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.tv-card.playing {
    border-color: var(--green);
    background: linear-gradient(to bottom, white 0%, #f1f8f4 100%);
}

.tv-card.offline {
    border-color: var(--red);
    background: linear-gradient(to bottom, white 0%, #fef1f1 100%);
}

.tv-card.buffering {
    border-color: var(--yellow);
    background: linear-gradient(to bottom, white 0%, #fffef1 100%);
}

.tv-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--light-gray);
}

.tv-icon {
    font-size: 2em;
}

.tv-id {
    font-weight: bold;
    font-size: 1.1em;
    color: var(--dark-gray);
    flex: 1;
}

.tv-status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
}

.tv-status-badge.playing {
    background: var(--green);
    color: white;
}

.tv-status-badge.offline {
    background: var(--red);
    color: white;
}

.tv-status-badge.buffering {
    background: var(--yellow);
    color: black;
}

.tv-body {
    margin-bottom: 15px;
}

.tv-info {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.tv-info label {
    font-size: 0.85em;
    color: var(--medium-gray);
    margin-bottom: 4px;
    font-weight: 600;
}

.tv-info span {
    font-size: 1em;
    color: var(--dark-gray);
}

.tv-info .video-name {
    color: var(--primary-red);
    font-weight: 600;
    font-family: monospace;
}

.tv-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--light-gray);
}

.btn-tv-action {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--light-gray);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-tv-action:hover {
    background: var(--primary-red);
    color: white;
    border-color: var(--primary-red);
}

.stores-table td {
    padding: 15px 10px;
    font-size: 0.9em;
}

.stores-table td:first-child {
    width: 40px;
}

.status-indicator {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.active {
    background: var(--green);
}

.status-indicator.inactive {
    background: var(--red);
}

.tags-cell {
    font-size: 0.85em;
    color: var(--medium-gray);
}

/* Table Footer */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.pagination-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.pagination-info select {
    padding: 5px 10px;
    border: 1px solid var(--light-gray);
    border-radius: 5px;
    font-size: 0.9em;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-page {
    background: var(--light-gray);
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.btn-page:hover:not(:disabled) {
    background: var(--medium-gray);
    color: white;
}

.btn-page:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#paginationInfo {
    font-weight: bold;
    min-width: 120px;
    text-align: center;
}

/* Responsive */
@media (max-width: 1200px) {
    .stores-table {
        font-size: 0.85em;
    }
    
    .stores-table th,
    .stores-table td {
        padding: 10px 8px;
    }
}

/* Video Selection Modal */
.video-selection-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
    font-size: 24px;
    color: var(--primary-red);
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.close-btn:hover {
    background: #f5f5f5;
    color: var(--primary-red);
}

.modal-body {
    padding: 30px;
}

.video-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.video-option {
    display: flex;
    align-items: center;
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.video-option:hover {
    border-color: var(--primary-red);
    background: #fff5f5;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.1);
}

.video-thumb {
    font-size: 48px;
    margin-right: 20px;
}

.video-info h3 {
    font-size: 18px;
    color: var(--dark-gray);
    margin-bottom: 5px;
}

.video-info p {
    font-size: 13px;
    color: var(--medium-gray);
    word-break: break-all;
}

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-actions {
        justify-content: stretch;
    }
    
    .btn-action, .btn-add-new {
        flex: 1;
    }
    
    .stores-table-container {
        overflow-x: auto;
    }
    
    .stores-table {
        min-width: 1000px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .video-option {
        flex-direction: column;
        text-align: center;
    }
    
    .video-thumb {
        margin-right: 0;
        margin-bottom: 10px;
    }
}
