/* Basic Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 800px;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1, h2 {
    color: #1a252f;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-top: 0;
}

h2 {
    margin-top: 20px;
}

/* Status Container */
#status-container {
    padding: 15px;
    border-radius: 6px;
    border: 1px solid;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

#status-container.status-offline {
    background-color: #fff5f5;
    border-color: #e53e3e;
    color: #c53030;
}

#status-container.status-online {
    background-color: #f0fff4;
    border-color: #38a169;
    color: #2f855a;
}

#status-container h2 {
    text-align: center;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.info-grid p {
    margin: 0;
    padding: 5px;
    background-color: #f9f9f9;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.info-grid .info-log {
    grid-column: 1 / -1; /* Span full width */
}

/* Controls & Buttons */
.btn {
    padding: 12px 20px;
    font-size: 1em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    background-color: #e2e8f0;
    color: #2d3748;
    font-weight: bold;
}

.btn:hover {
    background-color: #cbd5e0;
}

.btn:active {
    transform: scale(0.98);
}

.btn.btn-danger {
    background-color: #e53e3e;
    color: white;
}

.btn.btn-danger:hover {
    background-color: #c53030;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

/* Station Grid */
.station-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.station-grid .btn {
    padding: 15px 10px;
    text-align: center;
    background-color: #4a5568;
    color: white;
}

.station-grid .btn:hover {
    background-color: #2d3748;
}

/* New Station Selector */
.station-selector-container {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
}

.station-selector {
    height: 250px; /* 5 items * 50px item height */
    overflow-y: scroll;
    border: 1px solid #ccc;
    border-radius: 8px;
    position: relative;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.station-selector::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.station-wheel {
    padding-top: 100px; /* 2 items * 50px to center the first real item */
    padding-bottom: 100px; /* 2 items * 50px to center the last real item */
}

.station-item {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1.1em;
    color: #888;
    transition: opacity 0.1s ease, transform 0.1s ease, color 0.1s ease, font-size 0.1s ease;
    /* Truncate text on wide screens where the column is narrow */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 10px;
}

.station-item.selected {
    color: #1a252f;
    font-weight: bold;
    font-size: 1.3em;
    opacity: 1;
    transform: scale(1);
}





#btn-play-selected {
    padding: 20px 25px;
    font-size: 1.2em;
    background-color: #38a169;
    color: white;
}

#btn-play-selected:hover {
    background-color: #2f855a;
}

/* Alarm Controls */
.alarm-controls {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.alarm-time {
    padding: 10px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 6px;
}

#volume {
    display: inline-block;
    width: 25px;
    text-align: left;
}

/* Volume Icon */
#volume-icon {
    margin-left: 10px;
    display: inline-flex;
    align-items: flex-end;
    height: 16px;
}

.volume-bar {
    width: 4px;
    background-color: #e0e0e0;
    margin-right: 2px;
    display: inline-block;
    transition: height 0.2s ease, background-color 0.2s ease;
}

.volume-bar.active {
    background-color: #38a169;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    .container {
        padding: 15px;
    }
    #status-container {
        padding: 1px;
    }
    .controls-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .station-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }

    /* Responsive layout for station selector */
    .station-selector-container {
        grid-template-columns: 1fr; /* Switch to a single column layout */
        gap: 10px;
    }

    .station-item {
        white-space: normal; /* Allow text to wrap on narrow screens */
        text-overflow: initial;
        overflow: visible;
    }

    #btn-play-selected {
        width: 100%;
        padding: 15px 20px; /* Adjust padding for full width */
    }
}

@media (max-width: 400px) {
    .alarm-controls {
        grid-template-columns: 1fr; /* Stack controls vertically */
    }

    .alarm-controls .btn {
        width: 100%; /* Make buttons full width */
        box-sizing: border-box; /* Include padding in the width calculation */
    }
}