/* styles.css */

/* Reset box-sizing */
* {
    box-sizing: border-box;
}

/* Ensure html and body fill the viewport height and have no margin or padding */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #121212;
    color: #e0e0e0;
    /* Remove padding to prevent extra space */
}

/* Adjust container elements */
.admin-container, .user-container, .login-container {
    max-width: 1200px;
    margin: auto;
    /* Remove padding-bottom to prevent extra space at the bottom */
    /* padding-bottom: 70px; */
    height: 100%;
}

/* Ensure the .user-container fills the available height */
.user-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Categories Container */
#categoriesContainer {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 10px;
    height: 100vh;
    width: 100%;
    overflow: hidden; /* Prevent scrolling */
}

/* Category Buttons */
.category-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%; /* Fill the entire grid cell */
    margin: 0;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: clamp(16px, 2.5vw, 32px); /* Responsive font size */
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    overflow-wrap: break-word;
    word-break: break-word;
    background-color: #1e3a8a;
    color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

/* Hover effect for category buttons */
@media (hover: hover) and (pointer: fine) {
    .category-btn:hover {
        background-color: #2a4494;
        transform: translateY(-5px);
        box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    }
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    #categoriesContainer {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px; /* Ensure equal spacing on mobile as well */
        height: calc(var(--vh, 1vh) * 100); /* Full viewport height */
        grid-auto-rows: 1fr; /* Rows will fill the remaining space equally */
    }

    .category-btn {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    #categoriesContainer {
        grid-template-columns: repeat(1, 1fr);
        gap: 10px; /* Ensure equal spacing on mobile as well */
        height: calc(var(--vh, 1vh) * 100); /* Full viewport height */
        grid-auto-rows: 1fr; /* Rows will fill the remaining space equally */
    }

    .category-btn {
        font-size: 24px;
    }
}

h2 {
    text-align: center;
}

nav {
    text-align: center;
    margin-bottom: 20px;
}

nav a {
    margin: 0 10px;
}

form label {
    display: block;
    margin-top: 10px;
}

form input[type="text"], form input[type="password"], form input[type="file"], form select {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
}

form button {
    margin-top: 15px;
    padding: 10px 15px;
}

.error {
    color: red;
    margin-bottom: 10px;
    font-weight: bold;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

table th, table td {
    padding: 10px;
    border: 1px solid #ddd;
}

.btn {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 15px;
}

/* PIN Pad Styling */
#pinContainer {
    max-width: 300px;
    margin: 50px auto;
    text-align: center;
}

#pinPad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.pinButton {
    font-size: 24px;
    padding: 20px;
    background-color: #2c2c2c;
    border: none;
    border-radius: 10px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.pinButton:hover {
    background-color: #3a3a3a;
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(0,0,0,0.4);
}

.pinButton:active, .pinButton.active {
    background-color: #4a4a4a;
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Categories and Songs Grid */
#categoriesContainer, #songsContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0; /* Reduced from 20px to 10px */
    width: 100%; /* Ensure full width */
}

.category-btn, .song-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    /* Remove fixed height */
    margin-bottom: 0;
    text-align: center;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 32px; /* Increased font size from existing 16px or 27px */
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.category-btn {
    background-color: #1e3a8a;
    color: white;
    transition: background-color 0.3s ease; /* Add transition for smooth color change */
}

/* Add hover effect for desktop */
@media (hover: hover) and (pointer: fine) {
    .category-btn:hover {
        background-color: #2a4494; /* Slightly lighter shade */
        transform: translateY(-5px);
        box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    }
}

.category-btn:hover, .song-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

.category-btn:active, .song-btn:active {
    transform: translateY(2px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.category-title {
    text-align: center;
    margin-top: 0; /* Added to remove space above */
    margin-bottom: 15px; /* Reduced from 20px to 15px */
    padding: 0 15px 5px; /* Removed top padding, kept bottom padding */
    background-color: transparent;
    color: #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: 1.5em; /* Reduced from 1.3em */
    font-weight: bold;
    border-bottom: 1px solid #3d4451;
    width: 100%;
}

.songs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
}

.back-btn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    background-color: #3d4451;
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 18px; /* Increased from 16px */
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.back-btn:hover {
    background-color: #4a5568;
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 7px 20px rgba(0,0,0,0.4);
}

.back-btn:active {
    transform: translateX(-50%) translateY(1px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        font-size: clamp(16px, 2.5vw, 18px);
        padding: 10px;
    }

    #categoriesContainer {
        display: grid;
        grid-template-columns: repeat(2, 1fr); /* 2 columns */
        gap: 10px;
        height: calc(var(--vh, 1vh) * 100); /* Full viewport height */
        grid-auto-rows: 1fr; /* Rows will fill the remaining space equally */
    }

    .category-btn {
        width: 100%; /* Ensure buttons fill the grid cell width */
        aspect-ratio: auto; /* Remove the aspect-ratio for mobile */
    }

    .pinButton {
        font-size: 24px;
        padding: 20px;
    }

    .back-btn {
        font-size: 18px;
        padding: 15px 30px;
    }

    .songs-grid {
        grid-template-columns: repeat(2, 1fr); /* Changed to 2 columns */
        gap: 10px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 16px;
        padding: 5px;
    }

    #categoriesContainer {
        display: grid;
        grid-template-columns: repeat(2, 1fr); /* 2 columns */
        gap: 10px;
        height: calc(var(--vh, 1vh) * 100); /* Full viewport height */
        grid-auto-rows: 1fr; /* Rows will fill the remaining space equally */
    }

    .category-btn {
        width: 100%;
        aspect-ratio: auto; /* Remove the aspect-ratio for mobile */
    }

    .pinButton {
        font-size: 20px;
        padding: 15px;
    }

    .back-btn {
        font-size: 16px;
        padding: 12px 24px;
    }

    .songs-grid {
        grid-template-columns: repeat(2, 1fr); /* Changed to 2 columns */
    }
}

/* Stop Button Styling */
#playerContainer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

#stopButton {
    width: 80vw;
    height: 80vw;
    max-width: 250px;
    max-height: 250px;
    background-color: #c53030;
    color: #fff;
    font-size: clamp(16px, 5vw, 28px);
    padding: 20px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

#stopButton:hover {
    background-color: #e53e3e;
    transform: scale(1.05);
    box-shadow: 0 7px 20px rgba(0,0,0,0.4);
}

#stopButton:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

@media (max-width: 480px) {
    #stopButton {
        max-width: 200px;
        max-height: 200px;
    }
}

/* Styles for the sortable category list */
#categoryList {
    list-style-type: none;
    padding: 0;
    margin: 15px 0;
}

#categoryList li {
    padding: 10px 15px;
    margin-bottom: 5px;
    background-color: #1e3a8a;
    color: white;
    border-radius: 5px;
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#categoryList li:hover {
    background-color: #274ba1;
}

#categoryList li .actions a {
    color: #cbd5e0;
    text-decoration: none;
    margin-left: 10px;
}

#categoryList li .actions a:hover {
    text-decoration: underline;
}

/* Admin Dashboard Navigation Styles */
.admin-container nav a,
.admin-container .btn {
    color: #63b3ed; /* Light blue for unvisited links */
    text-decoration: none;
    transition: color 0.3s ease;
    margin: 0 10px;
}

.admin-container nav a:visited,
.admin-container .btn:visited {
    color: #9ae6b4; /* Light green for visited links */
}

.admin-container nav a:hover,
.admin-container nav a:focus,
.admin-container .btn:hover,
.admin-container .btn:focus {
    color: #90cdf4; /* Slightly lighter blue on hover/focus */
    text-decoration: underline;
}