.container {
    margin: 3em;
    text-align: center;
}

.tv-title {
    text-align: center;
    color: #ebbd00;
}

.tv-title span {
    font-size: 20px;
    font-weight: bold;
    color: #d80100;
}

.tv-last-update {
    text-align: center;
    color: #00b844;
    margin-bottom: 1em;
}

.tv-last-update-time {
    color: black;
}

.tv-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    margin-bottom: 20px;
}

.tv-table th {
    border-block-start: none !important;
    padding: 8px;
    text-align: center;
    border: none;
}

.tv-table td {
    border: none;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    vertical-align: middle;
}

.tv-table .tv-theme-icon a {
    display: inline-block;
}

.tv-table .prev-week {
    font-size: 0.7em;
    color: green;
}

.tv-table .prev-week.negative {
    color: darkred;
}

.tv-week-link {
    color: #007bff;
    text-decoration: none;
    border: 1px solid #007bff;
    padding: 0.3em;
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
}

@media screen and (max-width: 768px) {
    .tv-table .tv-theme-icon img {
        width: 40px;
    }
}

@media screen and (max-width: 425px) {
    .container {
        margin: 0.5em;
    }
    .tv-table .tv-theme-icon img {
        width: 30px;
    }
    .tv-table {
        font-size: 0.5em;
        line-height: 0.5em;
    }
    .tv-table td {
        padding: 4px;
    }
}

/* Modal Styles */
.tv-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.tv-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: none;
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    box-shadow: 0 4px 20px 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);
    }
}

.tv-modal-header {
    padding: 20px 24px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tv-modal-header h2 {
    margin: 0;
    color: #343a40;
    font-size: 1.5rem;
}

.tv-modal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tv-download-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s ease;
}

.tv-download-btn:hover {
    background-color: #218838;
}

.tv-download-btn:active {
    background-color: #1e7e34;
}

.tv-download-btn svg {
    flex-shrink: 0;
}

.tv-modal-close {
    color: #6c757d;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.tv-modal-close:hover,
.tv-modal-close:focus {
    color: #dc3545;
}

.tv-modal-body {
    padding: 24px;
    height: calc(80vh - 100px);
    max-height: calc(80vh - 100px);
    min-height: 400px;
    position: relative;
    overflow: hidden;
}

.tv-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 1.1rem;
    color: #6c757d;
}

.tv-chart-container {
    height: 100%;
    position: relative;
    overflow: hidden;
}

#tv-sales-chart {
    max-width: 100%;
    max-height: 100%;
}

.tv-item-row:hover {
    background-color: #f8f9fa;
    transition: background-color 0.2s ease;
}

/* Responsive modal */
@media screen and (max-width: 768px) {
    .tv-modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .tv-modal-header {
        padding: 15px 20px;
    }
    
    .tv-modal-header h2 {
        font-size: 1.3rem;
    }
    
    .tv-download-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .tv-download-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .tv-modal-body {
        padding: 20px;
        height: calc(85vh - 100px);
        max-height: calc(85vh - 100px);
        min-height: 300px;
    }
}

/* Fullscreen modal for mobile landscape and small screens */
@media screen and (max-width: 926px) and (max-height: 500px), 
       screen and (max-width: 480px) {
    .tv-modal-content {
        width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .tv-modal-header {
        padding: 12px 16px;
        flex-shrink: 0;
    }
    
    .tv-modal-header h2 {
        font-size: 1.2rem;
        line-height: 1.2;
    }
    
    .tv-download-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .tv-download-btn svg {
        width: 12px;
        height: 12px;
    }
    
    .tv-modal-close {
        font-size: 24px;
    }
    
    .tv-modal-body {
        padding: 16px;
        flex: 1;
        height: auto;
        max-height: none;
        min-height: auto;
        overflow: auto;
        display: flex;
        flex-direction: column;
    }
    
    .tv-loading {
        height: auto;
        max-height: none;
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 200px;
    }
    
    .tv-chart-container {
        height: auto;
        max-height: none;
        flex: 1;
        min-height: 200px;
        display: flex;
    }
    
    #tv-sales-chart {
        width: 100% !important;
        height: 100% !important;
        flex: 1;
    }
}

/* Portrait mobile optimization */
@media screen and (max-width: 480px) and (orientation: portrait) {
    .tv-modal-content {
        height: 100vh;
    }
    
    .tv-modal-body {
        min-height: calc(100vh - 120px);
    }
}

/* Landscape mobile optimization */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .tv-modal-content {
        height: 100vh;
    }
    
    .tv-modal-header {
        padding: 8px 12px;
    }
    
    .tv-modal-header h2 {
        font-size: 1.1rem;
    }
    
    .tv-modal-body {
        padding: 12px;
        min-height: calc(100vh - 80px);
    }
}