/* Reusable Components */

/* Button Component */
.btn {
    padding: 0.625vh 1.25vw;
    border-radius: 0.42vw;
    background-color: #424242;
    color: #FFFFFF;
    font-size: 1.125rem;
    font-weight: 600;
    border: 0.16vw solid transparent;
    text-align: center;
    display: inline-block;
}

.btn-primary {
    background-color: #2196F3;
}

.btn.focused {
    background-color: #2196F3; /* Highlight on focus */
    border-color: #FFFFFF;
}

/* Card Component */
.card {
    width: 14.58vw;
    height: 18.52vh;
    background-color: #2a2a2a;
    border-radius: 0.625vw;
    padding: 0.83vw;
    box-shadow: 0 0.1vh 0.42vw rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 0.16vw solid transparent;
}

.card.focused {
    background-color: #3a3a3a;
    border-color: #2196F3;
}

/* Grid Layout */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14.58vw, 1fr));
    gap: 1.04vw;
    padding: 1.04vw;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

/* Loading Spinner */
.spinner {
    border: 0.21vw solid rgba(255, 255, 255, 0.1);
    width: 1.875vw;
    height: 3.33vh;
    border-radius: 50%;
    border-left-color: #2196F3;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal/Dialog */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background-color: #1a1a1a;
    padding: 2.08vw;
    border-radius: 0.625vw;
    width: 31.25vw;
    text-align: center;
    border: 0.05vw solid #424242;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 9.26vh;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background-color: rgba(0,0,0,0.9);
    color: white;
    padding: 0.78vh 1.56vw;
    border-radius: 0.42vw;
    font-size: 1.125rem;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Media Queries for Different TV Resolutions */

/* 720p TVs (1280x720) */
@media screen and (max-width: 1280px) and (max-height: 720px) {
    :root {
        font-size: 14px; /* Scale down base font */
    }
    
    .card {
        width: 16vw;
        height: 20vh;
    }
    
    .modal-content {
        width: 35vw;
        padding: 2.5vw;
    }
}

/* 1080p TVs (1920x1080) - Default/Base */
@media screen and (min-width: 1281px) and (max-width: 1920px) {
    :root {
        font-size: 16px; /* Base font size */
    }
}

/* 4K TVs (3840x2160) */
@media screen and (min-width: 1921px) {
    :root {
        font-size: 18px; /* Scale up base font */
    }
    
    .card {
        width: 13vw;
        height: 17vh;
    }
    
    .modal-content {
        width: 28vw;
        padding: 1.8vw;
    }
    
    .spinner {
        width: 1.5vw;
        height: 2.8vh;
    }
}
