/* Daily Sweepstakes Manager Grid CSS */

/* Performance optimizations - avoid JS CSS manipulation */
.dynamic-timer-grid.showing-available-timers .timer-list,
.dynamic-timer-grid.showing-available-timers .available-timers-grid {
    min-height: auto !important;
}

.timer-list.fixed-height,
.available-timers-grid.fixed-height {
    min-height: 400px;
}

/* Cloned add box state styling - avoid JS CSS manipulation */
#cloned-add-timer-box.has-selections {
    background: linear-gradient(145deg,rgb(21, 47, 22),rgb(25, 75, 26)) !important;
}

#cloned-add-timer-box.no-selections {
    background: linear-gradient(145deg, rgba(20, 20, 20, 0.4), rgba(30, 30, 30, 0.4)) !important;
}

/* Main Container */
.dynamic-timer-grid {
    display: flex;
    flex-direction: column;
    width: calc(100% - 250px);
    /* max-width: 1200px; */
    margin: 0 auto;
    padding-top: 9px;
    position: relative;
    left: 100px;
    align-items: center;
    min-height: calc(80vh - 200px);
    height: auto;
    top: 25px;
    /* Ensure enough space for pagination at bottom */
    padding-bottom: 100px;
}

/* Prevent shifting below 1200px */
@media screen and (max-width: 1200px) {
    .dynamic-timer-grid {
        width: 100%;
        left: 0;
    }
    
    /* Ensure no shifting when sidebar is open below 1200px */
    body.sidebar-open .dynamic-timer-grid {
        left: 0;
    }
}

/* Title */
.daily-sweepstakes-title {
    font-size: 36px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 30px;
    font-style: italic;
}

/* Timer Content Area - Fixed height container */
.timer-content-area {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    
}

/* Grid Layout */
.timer-list, .available-timers-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    justify-content: center;
    transition: transform 0.3s ease-out;
}

/* Add Timer Box */
.add-timer-box {
    display: flex;
    right: 6px;
    position: relative;
    align-items: center;
    justify-content: center;
    height: 105px;
    min-width: 280px;
    max-width: 100%;
    margin: 0 auto;
    border: 1.5px dashed rgba(76, 175, 80, 0.6);
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(20, 20, 20, 0.4), rgba(30, 30, 30, 0.4));
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

.add-timer-box span {
    font-size: 40px;
    color: var(--timer-text-color, #4CAF50);
    margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

.add-timer-box p {
    color: var(--timer-text-color, #ffffff);
    font-weight: 500;
    margin: 0;
}

.add-timer-box:hover {
    border-color: #4CAF50;
    background: linear-gradient(145deg, rgba(30, 30, 30, 0.5), rgba(40, 40, 40, 0.5));
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.add-timer-box.update-mode {
    background: linear-gradient(145deg, #2e8f32, #1b7e1e);
    color: white;
    border-color: #4CAF50;
    
}

/* Timer Wrapper */
.timer-wrapper {
    cursor: default;
    position: relative;
    text-align: center;
    transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    
    backdrop-filter: blur(5px);
    
    height: 105px;
    
    min-width: 280px;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    
}

.timer-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.timer-wrapper.dragging {
    opacity: 0.7;
    z-index: 1000;
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.timer-wrapper.over {
    border: 2px dashed rgba(76, 175, 80, 0.6);
    background: rgba(76, 175, 80, 0.1);
}

.timer-wrapper.no-match {
    display: none;
}

.timer-removing {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Hide timers until they're sorted */
.timer-list.not-sorted {
    opacity: 0;
    visibility: hidden;
}

/* Timer image styles */
.timer-image {
    position: relative;
    width: 170px;
}

.timer-image img {
    margin-top: -22px;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.timer-image img:hover {
    transform: scale(1.05);
}

/* Countdown timer styles */
.countdown-timer.blurred .blurred-content {
    filter: blur(5px);
    pointer-events: none;
}

/* Favorite button styles - original position */
.favorite-timer {
    position: relative;
    right: 115px;
    bottom: 45px;
    background: none;
    border: none;
    color: white;
    font-size: 23px;
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s ease;
}

.favorite-timer:hover {
    color: #ffd700;
}

.favorite-timer.favorite {
    color: #ffd700;
    text-shadow: 
        0 0 4px rgba(255, 215, 0, 0.5),
        0 0 8px rgba(255, 215, 0, 0.3),
        0 0 12px rgba(255, 215, 0, 0.2);
    animation: starGlow 2s ease-in-out infinite alternate;
}

/* Remove timer button styles - original position */
.timer-wrapper .remove-timer {
    position: relative;
    bottom: 15px;
    left: 118px;
    background: radial-gradient(circle at bottom, rgb(46 46 46) 0%, rgb(23 23 23 / 90%) 60%, rgba(40, 40, 40, 1) 100%);
    color: rgb(255 255 255 / 90%);
    border: none;
    border-radius: 50%;
    width: 21px;
    height: 21px;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 10;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.1), inset 0 -2px 4px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.3);
}

.timer-wrapper .remove-timer::before {
    content: "✕";
    display: block;
    transition: all 0.3s ease-out;
    transform: scale(0.9);
}

.timer-wrapper .remove-timer:hover::before {
    transform: scale(1.1);
    text-shadow: 
        0 0 3px rgba(255,255,255,0.5),
        0 0 6px rgba(255,100,100,0.3);
}

.timer-wrapper .remove-timer:active {
    transform: scale(0.95) translateZ(0);
    box-shadow: 
        inset 0 3px 5px rgba(0,0,0,0.4),
        inset 0 -1px 2px rgba(255,255,255,0.1);
}

/* Available Timers Grid */
.available-timers-grid {
    display: none;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto 80px auto;
    position: relative;
    top: 20px;
}

/* When available timers are visible */
.dynamic-timer-grid.available-timers-visible .available-timers-grid {
    display: grid;
}

.dynamic-timer-grid.available-timers-visible .timer-list {
    display: none;
}

/* Ensure pagination stays in consistent position for available timers view */
.dynamic-timer-grid.available-timers-visible .pagination-nav-container {
    margin: -38px auto 30px;
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    z-index: 12;
}

.available-timer-box {
    position: relative;
    text-align: center;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(30, 30, 30, 0.7), rgba(40, 40, 40, 0.7));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.3);
    height: 105px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.available-timer-box:hover {
    background: linear-gradient(145deg, rgba(40, 40, 40, 0.6), rgba(50, 50, 50, 0.6));
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.available-timer-box:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
    background: linear-gradient(145deg, rgba(40, 40, 40, 0.6), rgba(50, 50, 50, 0.6));
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.available-timer-box.selected {
    background: linear-gradient(145deg, rgba(44, 90, 46, 0.8), rgba(29, 88, 32, 0.8));   
    color: white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.available-timer-box.added {
    color: #4CAF50;
}

.available-timer-box.added::after {
    content: '✓';
    color: #4CAF50;
    position: absolute;
    right: 15px;
    font-weight: bold;
}

.available-timer-box.added.selected-for-removal {
    background: linear-gradient(145deg, rgba(244, 67, 54, 0.2), rgba(211, 47, 47, 0.2));
    color: #d32f2f;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.available-timer-box.added.selected-for-removal::after {
    content: '×';
    color: #d32f2f;
}

.available-timer-box.no-match {
    display: none;
}

/* Controls Container */
.grid-controls-container {
    display: flex;
        max-width: 1200px;
        position: relative;
}

.grid-controls {
    display: grid;
    grid-template-areas:
        "pagination search sort";
    grid-template-columns: auto auto auto;
    gap: 10px;
    width: fit-content;
    margin-left: 0;
    align-items: center;
}

/* Layout for available timers view with sort-available-timers visible */
.grid-controls.available-timers-view {
    grid-template-areas:
        "pagination available-sort search sort buttons";
    grid-template-columns: auto auto auto auto auto;
}

/* Search Section */
.search-section {
    position: relative;
    min-width: 150px;
    flex-shrink: 0;
    grid-area: search;
}

/* Sort Dropdown */
.sort-timers-dropdown {
    grid-area: sort;
}

/* Available Timers Sort Dropdown */
#sort-available-timers {
    grid-area: available-sort;
}

/* Button Container - Add/Remove All Buttons */
.button-container {
    grid-area: buttons;
    display: flex;
    justify-content: center;
    gap: 0px;
    align-items: center;
}


.pagination-controls {
    flex-shrink: 0;
    grid-area: pagination;
    margin-left: 0;
    /* Ensure pagination stays at bottom */
    margin-top: auto;
    /* Force pagination to bottom of container */
    align-self: flex-end;
}
/* Pagination Controls */
.pagination-controls {
    flex-shrink: 0;
    grid-area: pagination;
    margin-left: 0;
    /* Ensure pagination stays at bottom */
    margin-top: auto;
    /* Force pagination to bottom of container */
    align-self: flex-end;
}

/* Sorting Controls */
.sort-timers-dropdown {
    background: linear-gradient(145deg, rgba(20, 20, 20, 0.4), rgba(30, 30, 30, 0.4));
    border: 1px solid rgba(76, 175, 80, 0.2);
    border-radius: 8px;
    color: #fff;
    padding: 10px 15px;
    font-size: 14px;
    min-width: 120px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.sort-timers-dropdown:hover {
    border-color: rgba(76, 175, 80, 0.4);
    background: linear-gradient(145deg, rgba(25, 25, 25, 0.5), rgba(35, 35, 35, 0.5));
}

#sort-timers {
    width: 198px;

}

#sort-timers option,
#sort-available-timers option {
    background-color: #0a0a0a;
    color: white;
    border: none;
}

#sort-timers:focus-visible {
    outline: none;
    border-color: rgba(76, 175, 80, 0.6);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.2);
}

/* Search Input */
.timer-search-input {
    background: linear-gradient(145deg, rgba(20, 20, 20, 0.4), rgba(30, 30, 30, 0.4));
    border: 1px solid rgba(76, 175, 80, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    color: white;
    padding: 10px 15px;
    font-size: 14px;
    width: 150px;
    
    padding-right: 30px;
}
.timer-search-input::placeholder {
    color: rgb(255, 255, 255);
    opacity: 0.6;
}

.timer-search-input:hover {
    border-color: rgba(76, 175, 80, 0.4);
}

.timer-search-input:focus-visible {
    outline: none;
    border-color: rgba(76, 175, 80, 0.6);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.2);
}

.timer-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgb(255, 255, 255);
    cursor: pointer;
    font-size: 14px;
    display: none;
}

.timer-search-input.has-text + .timer-search-clear {
    display: block;
}

/* Pagination Button */
.pagination-button {
    background: linear-gradient(145deg, #424242, #303030);
    border: none;
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    height: 40px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.pagination-button:hover {
    background: linear-gradient(145deg, #4a4a4a, #383838);
    color: #4CAF50;
}

/* Disabled state */
.pagination-button:disabled {
    opacity: 0.6;
    
}

/* Enabled state - green background */
.pagination-button.enabled {
    background: linear-gradient(145deg, #388E3C, #2E7D32);
    color: #fff;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3),
                0 0 20px rgba(76, 175, 80, 0.2),
                inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

.pagination-button.enabled:hover {
    background: linear-gradient(145deg, #43A047, #388E3C);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.4),
                0 0 30px rgba(76, 175, 80, 0.2),
                inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

/* Pagination Navigation */
.pagination-nav-container {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    margin: 20px auto 30px;
    position: relative;
    z-index: 11;
    
}

/* Ensure pagination always stays at bottom, even with minimal content */
.dynamic-timer-grid:has(.timer-list:empty) .pagination-nav-container,
.dynamic-timer-grid:has(.available-timers-grid:empty) .pagination-nav-container {
    position: absolute;
    
    left: 50%;
    transform: translateX(-50%);
}

/* Fallback for browsers that don't support :has() */
.dynamic-timer-grid .pagination-nav-container {
    /* Ensure pagination is positioned at bottom when content is minimal */
    position: sticky;
    bottom: 5px;
}

.pagination-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: -20px;
    background: linear-gradient(145deg, rgba(20, 20, 20, 0.4), rgba(30, 30, 30, 0.4));
    border-radius: 8px;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    padding: 12px 25px;
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.pagination-nav .pagination-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.pagination-nav button {
    background: linear-gradient(145deg, #2e8f32, #1b7e1e);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.pagination-nav button:hover:not(:disabled) {
    background: linear-gradient(145deg, #3aa33e, #2a9e2e);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.pagination-nav button:disabled {
    background: linear-gradient(145deg, #333333, #222222);
    opacity: 0.7;
    cursor: not-allowed;
}

.pagination-nav button.first-page,
.pagination-nav button.last-page {
    background: linear-gradient(145deg, #424242, #303030);
    border: none;
    color: #fff;
    padding: 5px;
    border-radius: 6px;
    cursor: pointer;
    height: 30px;
    width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 12px;
}

.pagination-nav button.first-page:hover,
.pagination-nav button.last-page:hover {
    background: linear-gradient(145deg, #4a4a4a, #383838);
    color: #4CAF50;
}

.pagination-nav button.first-page:disabled,
.pagination-nav button.last-page:disabled {
    background: linear-gradient(145deg, #222222, #1a1a1a);
    color: #666;
    cursor: not-allowed;
}

/* Button Styles */
.add-all-button, .remove-all-button {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    margin: 0 5px;
}

.add-all-button:hover {
    background: rgba(76, 175, 80, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
}

.remove-all-button {
    background: rgba(0, 0, 0, 0.8);
}

.remove-all-button:hover {
    background: rgba(244, 67, 54, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.3);
}

/* Apply Button */
.apply-button {
    background: linear-gradient(145deg, #4CAF50, #388E3C);
    border: none;
    color: white;
    padding: 16px 36px;
    text-align: center;
    display: none;
    font-size: 16px;
    cursor: pointer;
    border-radius: 50px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.apply-button:hover {
    background: linear-gradient(145deg, #5cb860, #43a047);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* Dailys Ready Button */
.dailys-ready-button {
    display: none !important;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(145deg, #2e8f32, #1b7e1e);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: none;
    z-index: 1000;
    border: none;
    font-weight: 700;
    animation: pulse 2s infinite;
    letter-spacing: 0.5px;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Notifications */
.grid-notification {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #4CAF50;
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1000;
    font-size: 16px;
}

/* Swipe Animation Classes */
.swiping-left {
    transform: translateX(-20px);
    opacity: 0.8;
}

.swiping-right {
    transform: translateX(20px);
    opacity: 0.8;
}

/* Ensure smooth transitions */
.timer-list, .available-timers-grid {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Page Overlay Styles */
.page-overlay {
    color: var(--timer-text-color, white);
    font-size: 14px;
    font-weight: bold;
    pointer-events: none;
    opacity: 1;
    margin: 0 10px;
    text-align: center;
    border: none;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-overlay .page-label {
    color: var(--timer-text-color, #cccccc);
    font-size: 12px;
    margin-right: 5px;
}

.page-overlay .page-number {
    color: #4CAF50;
    font-size: 14px;
    font-weight: bold;
    margin: 0 5px;
}

.page-overlay .page-total {
    color: #cccccc;
    font-size: 12px;
    opacity: 1;
}

/* Hide page overlay completely when not needed */
.page-overlay:empty {
    display: none;
}

/* Utility: keep element space but make invisible (used when no timers exist) */
.invisible {
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Ensure all elements with tabindex are focusable */
[tabindex] {
    outline: none;
}

[tabindex]:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* Specific focus styles for timer elements */
.countdown-timer:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
    border-radius: 12px;
}

.timer-link:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
    border-radius: 4px;
}

.favorite-timer:focus-visible,
.info-button:focus-visible,
.world-time-globe-icon:focus-visible,
.vpn-type-button:focus-visible,
.remove-timer:focus-visible,
.reg-type-button:focus-visible,
.start-reset-button:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* Focus styles for pagination buttons */
.first-page:focus-visible,
.prev-page:focus-visible,
.next-page:focus-visible,
.last-page:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* Focus styles for controls */
#toggle-pagination:focus-visible,
#timer-search:focus-visible,
#sort-timers:focus-visible,
#sort-available-timers:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}



/* DynamicTimerGrid.php inline styles */
.button-hidden {
    display: none;
}

.grid-hidden {
    display: none;
}

/* Mobile Responsiveness */
@media (min-width: 1900px) {
    
    .pagination-nav-container {

    
    }
}

@media (max-width: 1900px) and (min-width: 1201px) {
    .dynamic-timer-grid {
        width: 100%;
        left: 0;
    }

    body.sidebar-open .dynamic-timer-grid {
        /* Move to the right when sidebar opens, similar to dsm-site-header */
        left: 125px;
    }
}



@media (max-width: 1160px) {
    .timer-list, .available-timers-grid {
        grid-template-columns: repeat(2, minmax(280px, .3fr));
    }
    
    .timer-content-area {
        /* Add bottom margin to prevent pagination overlap */
        margin-bottom: 20px;
    }

    .grid-controls-container {
        position: relative;
    }

    /* Ensure sort-timers-dropdown maintains its position */
    .sort-timers-dropdown {
        position: relative;
        width: 100%;
    }

    .pagination-nav-container {
        margin: 20px auto 30px;
        position: relative;
        /* Ensure pagination doesn't float over content */
        clear: both;
    }
}

@media (max-width: 768px) and (min-width: 1201px) {
    .dynamic-timer-grid {
        width: 100%;
        left: 0;
    }

    .grid-controls {
        grid-template-columns: 1fr auto;
    }

    .search-section {
        min-width: 120px;
    }

    .sort-timers-dropdown {
        min-width: 100%;
    }

    .pagination-controls {
    }

    .pagination-nav-container {
    }

    body.sidebar-open .dynamic-timer-grid {
        /* Move to the right when sidebar opens, similar to dsm-sidebar-header */
        left: 125px;
    }
}

@media (max-width: 631px) {
    .grid-controls {
        grid-template-areas:
            "search pagination"
            "sort sort";
        grid-template-columns: 1fr auto;
        gap: 10px;
        width: 100%;
        justify-items: start;
    }

    .grid-controls.available-timers-view {
        grid-template-areas:
            "search pagination"
            "available-sort sort"
            "buttons buttons";
        grid-template-columns: 1fr auto;
        gap: 10px;
        width: 100%;
        justify-items: start;
    }
}

@media (max-width: 630px) {

    .timer-list, .available-timers-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 10px;
    }
    
    .timer-content-area {
    }

    .grid-controls-container {
        overflow-x: visible;
        justify-content: center;
        right: 0px;
    }

    /* Hide scrollbar */
    .grid-controls-container::-webkit-scrollbar {
        display: none;
    }

    /* Compact layout for available timers view */
    .grid-controls.available-timers-view {
        grid-template-areas:
            "search pagination"
            "available-sort sort"
            "buttons buttons";
        grid-template-columns: 1fr auto;
        gap: 10px;
        width: fit-content;
        margin-left: 0;
        align-items: center;
    }

    /* Mobile button container styling */
    .grid-controls.available-timers-view .button-container {
        
        width: 110%;
        margin-left: -15px;
        justify-content: space-evenly;
    }

    /* Make buttons more uniform on mobile */
    .grid-controls.available-timers-view .add-all-button,
    .grid-controls.available-timers-view .remove-all-button {
        flex: 1;
        max-width: 120px;
        min-width: 100px;
        text-align: center;
    }

    .pagination-nav-container {
        margin: 10px auto 20px !important;
        width: auto !important;
        max-width: calc(100% - 20px) !important;
    }
}

@media (max-width: 480px) {
    .dynamic-timer-grid {
        width: 100%;
        left: 0;
        padding-top: 0;
    }



    .pagination-nav-container {
        margin: 15px auto 25px;
        position: relative;
    }

    .timer-list, .available-timers-grid {
        position: relative;
        right: 30px;
    }

    .grid-controls-container {
        padding: 0 2px;
        justify-content: center;
        position: relative;
        right: 35px;
    }



    .search-section,
    .sort-timers-dropdown {
        min-width: auto;
    }

}

@media (max-width: 500px) {
    .dynamic-timer-grid {
        width: 100%;
        left: 0;
        padding-top: 0;
    }



   

    .grid-controls-container {
        padding: 0 10px;
        justify-content: center;
        position: relative;
        right: 0;
    }



    .search-section {
        min-width: auto;
        flex: 1;
    }

    .sort-timers-dropdown {
        min-width: auto;
        width: 100%;
    }

    /* Improve pagination navigation layout for mobile */
    .pagination-nav {
        display: grid;
        grid-template-areas:
            "first prev page next last";
        grid-template-columns: auto auto 1fr auto auto;
        gap: 8px;
        align-items: center;
        padding: 10px 15px;
        background: linear-gradient(145deg, rgba(20, 20, 20, 0.4), rgba(30, 30, 30, 0.4));
        border-radius: 8px;
        backdrop-filter: blur(5px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        border: 1px solid rgba(76, 175, 80, 0.2);
    }

    .pagination-nav .pagination-buttons {
        display: contents;
    }

    .pagination-nav button.first-page {
        grid-area: first;
    }

    .pagination-nav button.prev-page {
        grid-area: prev;
    }

    .pagination-nav .page-overlay {
        grid-area: page;
        justify-self: center;
    }

    .pagination-nav button.next-page {
        grid-area: next;
    }

    .pagination-nav button.last-page {
        grid-area: last;
    }

    .pagination-nav-container {
        margin: 15px auto 25px;
        position: relative;
        max-width: calc(100% - 20px);
    }

    .timer-list, .available-timers-grid {
        position: relative;
        right: 0;
    }
}