html, body { /* Added html to ensure full height/width */
    font-family: 'Inter', sans-serif;
    background-color: #1a202c; /* Dark background */
    color: #e2e8f0; /* Light text for contrast */
    padding: 0; /* Removed padding from body */
    margin: 0; /* Removed margin from body */
    width: 100dvw; /* Make body width 100% of viewport width */
    height: 100dvh; /* Make body height 100% of viewport height */
    overflow: hidden; /* Prevent body scrollbars if content overflows, rely on inner scrollbars */
    -webkit-user-select: none; /* Disable text selection for WebKit browsers */
    -moz-user-select: none; /* Disable text selection for Firefox */
    -ms-user-select: none; /* Disable text selection for Internet Explorer/Edge Legacy */
    user-select: none; /* Disable text selection for modern browsers */
}
/* Custom scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #2d3748; /* Darker track */
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    background: #4a5568; /* Slightly lighter thumb */
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #64748b; /* Even lighter on hover */
}

/* Custom styles for better aesthetics in dark theme */
.clock-card {
    background-color: #2d3748; /* Darker card background */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); /* More prominent shadow */
    border-radius: 12px; /* Rounded corners */
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 250px; /* Ensure cards have a minimum width */
    border: 1px solid #4a5568; /* Subtle border */
    cursor: grab; /* Indicate draggable */
    transition: transform 0.2s ease-in-out; /* Smooth transition for drag */
}
.clock-card.ui-sortable-helper {
    cursor: grabbing;
    opacity: 0.8;
    transform: scale(1.05); /* Slightly enlarge when dragging */
    z-index: 999; /* Ensure dragged item is on top */
}
.clock-card.locked {
    cursor: default; /* No grab cursor when locked */
}
.time-display {
    font-size: 2.5rem; /* Larger time font */
    font-weight: 700; /* Bold time */
    color: #90cdf4; /* Light blue for time */
    margin-top: 0.5rem;
    /* Removed flex properties as UTC offset is moved */
}
.date-display {
    font-size: 1rem;
    color: #a0aec0; /* Lighter gray text for date */
    margin-top: 0.25rem;
    display: flex; /* Enable flex for date to align offset */
    align-items: baseline; /* Align text by baseline */
    gap: 0.5rem; /* Space between date and offset */
}
.city-name {
    font-size: 1.25rem; /* Larger city name */
    font-weight: 600; /* Semi-bold city name */
    color: #e2e8f0; /* Light text for city */
    margin-bottom: 0.5rem;
    display: flex; /* Enable flex for city name to align flag */
    align-items: center;
    justify-content: center; /* Center content including flag */
    gap: 0.5rem; /* Added gap between flag and city name */
}
/* Modal styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #2d3748;
    margin: auto;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 800px; /* Increased max-width for a wider modal */
    position: relative;
    color: #e2e8f0;
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    color: #a0aec0;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

.city-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #4a5568;
}

.city-list-item:last-child {
    border-bottom: none;
}

.remove-button {
    background-color: #dc2626; /* Red */
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    display: flex; /* Use flex to align icon and text */
    align-items: center;
    gap: 0.25rem; /* Space between icon and text */
}

.add-button {
    background-color: #22c55e; /* Green */
    color: white;
    padding: 0.75rem 1rem; /* Adjusted padding to match input height */
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    display: flex; /* Use flex to align icon and text */
    align-items: center;
    gap: 0.5rem; /* Space between icon and text */
}

.reset-button {
    background-color: #f59e0b; /* Amber */
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    display: flex; /* Use flex to align icon and text */
    align-items: center;
    gap: 0.5rem; /* Space between icon and text */
}

/* Redesigned Settings, Lock, and Clock Format Buttons */
.action-button {
    background-color: transparent;
    color: #90cdf4; /* Light blue icon color */
    border: 1px solid #4a5568; /* Subtle border */
    padding: 0.5rem 0.75rem; /* Smaller padding */
    border-radius: 8px; /* Slightly more rounded */
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center; /* Center icon */
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    width: 44px; /* Fixed width for icon-only button */
    height: 44px; /* Fixed height for icon-only button */
}
.action-button:hover {
    background-color: #4a5568; /* Darker background on hover */
    color: #e2e8f0; /* Lighter text on hover */
    border-color: #64748b;
}
.action-button i {
    font-size: 1.1rem; /* Slightly larger icon */
}

/* Smaller Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px; /* Reduced width */
    height: 28px; /* Reduced height */
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 28px; /* Adjusted border-radius */
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 20px; /* Adjusted size */
    width: 20px; /* Adjusted size */
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background-color: #2196F3;
}

.toggle-switch input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

.toggle-switch input:checked + .slider:before {
    -webkit-transform: translateX(22px); /* Adjusted translateX */
    -ms-transform: translateX(22px);
    transform: translateX(22px);
}


/* Custom Select List Styles */
.city-select-custom {
    border: 1px solid #4a5568;
    border-radius: 6px;
    background-color: #1a202c;
    max-height: 200px; /* Increased height for better visibility */
    overflow-y: auto;
    color: #e2e8f0;
    padding: 0.5rem;
}

.city-select-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 4px; /* Slightly rounded corners for items */
    transition: background-color 0.2s ease;
}

.city-select-item:hover {
    background-color: #4a5568; /* Darker hover */
}

.city-select-item.selected {
    background-color: #4299e1; /* Blue for selected */
    color: white;
    font-weight: 600;
}

.message-box {
    background-color: #38a169; /* Green for success */
    color: white;
    padding: 1rem;
    border-radius: 8px;
    position: fixed;
    top: 20px; /* Changed from bottom to top */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    display: none; /* Hidden by default */
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.message-box.error {
    background-color: #e53e3e; /* Red for error */
}
.container {
    max-width: 100dvw !important;
    height: 100dvh !important;
    overflow-y: auto !important;
}

/* Scrollbar Arrow Buttons */
.scroll-arrow-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-left: 0.5rem; /* Space between list and arrows */
}
.scroll-arrow-button {
    background-color: transparent;
    color: #90cdf4;
    border: 1px solid #4a5568;
    padding: 0.3rem; /* Smaller padding for arrows */
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem; /* Smaller icon size for arrows */
    width: 30px; /* Fixed size for arrow buttons */
    height: 30px; /* Fixed size for arrow buttons */
}
.scroll-arrow-button:hover {
    background-color: #4a5568;
    color: #e2e8f0;
    border-color: #64748b;
}
.scroll-arrow-button:first-child {
    margin-bottom: 0.25rem; /* Space between up and down arrows */
}

#clocks-header {
    max-height: 200px !important;
}

@media only screen and (max-width: 900px) {
    .container {
        height: calc(100dvh - 65px) !important;
    }
}