/* DSM Sidebar CSS - Modern Edition */

.sidebar {
    height: 100%;
    width: 250px; /* Changed from 0 to 250px for desktop */
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    background: linear-gradient(145deg, #1a1a1a, #252525);
    overflow-y: auto;
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding-top: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 10px rgba(0, 0, 0, 0.2);
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    /* Prevent horizontal overflow */
    box-sizing: border-box;
}

.sidebar.open {
    width: 250px;
}

.sidebar a {
    padding: 12px 18px;
    text-decoration: none;
    font-size: 16px;
    color: var(--timer-text-color, #fff);
    display: block;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    top: 50px;
    border-left: 3px solid transparent;
    letter-spacing: 0.2px;
    /* Ensure links are focusable and have proper keyboard navigation */
    cursor: pointer;
    outline: none;
}

/* Resources dropdown caret styling */
.dsm-resources-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dsm-caret {
    display: inline-block;
    margin-left: 8px;
    transition: transform 0.25s ease;
    transform-origin: 50% 50%;
    float: inline-end;
}

.dsm-caret-open {
    transform: rotate(180deg);
}

/* Submenu offset to the right */
.dsm-resources-list {
    padding-left: 18px; /* base padding */
    margin-left: 12px; /* offset to the right */
}

.sidebar a:hover {
    background: linear-gradient(90deg, rgba(42, 42, 42, 0.8), rgba(42, 42, 42, 0));
    border-left: 3px solid #4CAF50;
    color: #fff;
    transform: translateX(2px);
}

/* Focus styles for keyboard navigation */
.sidebar a:not(.closebtn):not(.logoutbtn):focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
    background: linear-gradient(90deg, rgba(42, 42, 42, 0.8), rgba(42, 42, 42, 0));
    border-left: 3px solid #4CAF50;
}

/* Ensure focus styles work with hover */
.sidebar a:not(.closebtn):not(.logoutbtn):hover:focus-visible {
    background: linear-gradient(90deg, rgba(42, 42, 42, 0.8), rgba(42, 42, 42, 0));
    border-left: 3px solid #4CAF50;
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* Focus styles for the sidebar container itself */
.sidebar:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* Ensure all interactive elements in sidebar are properly focusable */
.sidebar button,
.sidebar input,
.sidebar select,
.sidebar textarea {
    outline: none;
}

.sidebar button:focus-visible,
.sidebar input:focus-visible,
.sidebar select:focus-visible,
.sidebar textarea:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

.sidebar .closebtn {
    position: absolute;
    top: 0;
    right: 25px;
    font-size: 36px;
    margin-left: 50px;
    display: none; /* Moved this here to ensure it's hidden by default */
    opacity: 0.8;
    transition: all 0.3s ease;
    /* Ensure close button is properly focusable */
    cursor: pointer;
    outline: none;
}

.sidebar .closebtn:hover {
    opacity: 1;
    color: #ff5252;
    transform: rotate(90deg);
}

/* Focus styles for close button */
.sidebar .closebtn:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
    opacity: 1;
    color: #ff5252;
}

/* Ensure focus styles work with hover */
.sidebar .closebtn:hover:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
    opacity: 1;
    color: #ff5252;
}

/* Website Title Header - Centered positioning and adjusted for sidebar */
.dsm-site-header {
    padding-top: 50px;
    padding-bottom: 0px;
    text-align: center;
    position: relative;
    z-index: 999;
    margin-right: auto;
    transition: none;
    max-width: 100%;
    margin-bottom: 5px;
    /* Fix positioning to prevent horizontal overflow */
    left: -40px;
    margin-left: 250px; /* Account for sidebar width */
    width: calc(100% - 250px); /* Ensure header doesn't overflow */
    box-sizing: border-box;
}

.dsm-site-title {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(28px, 6vw, 42px);
    font-weight: 700;
    margin: 0;
    color: #ffffff; /* Pure white color */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); /* Shadow for contrast */
    position: relative;
    display: inline-block;
    padding-right: 0;
    transition: font-size 0.3s ease-in-out;
}

.dsm-site-title a {
    -webkit-tap-highlight-color: transparent;
    outline: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Focus styles for site header link */
.dsm-site-title a:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 4px;
    border-radius: 4px;
}

/* Prevent space key scrolling when header is focused */
body.header-focused {
    overflow: hidden;
}

/* Simplified slot animation - true sequential animation with faster timing */
.slot-spin {
    display: inline-block;
    opacity: 0;
    animation: slotSpin 0.3s ease-out forwards; /* Reduced from 0.5s to 0.3s */
    transform-style: preserve-3d;
    transform-origin: 50% 50%;
    perspective: 1000px;
}

@keyframes slotSpin {
    0% {
        transform: rotateX(-180deg);
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    70% {
        transform: rotateX(20deg);
    }
    85% {
        transform: rotateX(-10deg);
    }
    100% {
        transform: rotateX(0deg);
        opacity: 1;
    }
}

/* Speed up only the second part of the title (after "Daily") */
.slot-spin:nth-child(1) { animation-delay: 0.00s; } /* D */
.slot-spin:nth-child(2) { animation-delay: 0.25s; } /* a */
.slot-spin:nth-child(3) { animation-delay: 0.50s; } /* i */
.slot-spin:nth-child(4) { animation-delay: 0.75s; } /* l */
.slot-spin:nth-child(5) { animation-delay: 1.00s; } /* y */
.slot-spin:nth-child(6) { animation-delay: 1.075s; } /* space - begin double speedup */
.slot-spin:nth-child(7) { animation-delay: 1.15s; } /* S */
.slot-spin:nth-child(8) { animation-delay: 1.225s; } /* w */
.slot-spin:nth-child(9) { animation-delay: 1.30s; } /* e */
.slot-spin:nth-child(10) { animation-delay: 1.375s; } /* e */
.slot-spin:nth-child(11) { animation-delay: 1.45s; } /* p */
.slot-spin:nth-child(12) { animation-delay: 1.525s; } /* s */
.slot-spin:nth-child(13) { animation-delay: 1.60s; } /* t */
.slot-spin:nth-child(14) { animation-delay: 1.675s; } /* a */
.slot-spin:nth-child(15) { animation-delay: 1.75s; } /* k */
.slot-spin:nth-child(16) { animation-delay: 1.825s; } /* e */
.slot-spin:nth-child(17) { animation-delay: 1.90s; } /* s */
.slot-spin:nth-child(18) { animation-delay: 1.975s; } /* space */
.slot-spin:nth-child(19) { animation-delay: 2.05s; } /* M */
.slot-spin:nth-child(20) { animation-delay: 2.125s; } /* a */
.slot-spin:nth-child(21) { animation-delay: 2.20s; } /* n */
.slot-spin:nth-child(22) { animation-delay: 2.275s; } /* a */
.slot-spin:nth-child(23) { animation-delay: 2.35s; } /* g */
.slot-spin:nth-child(24) { animation-delay: 2.425s; } /* e */
.slot-spin:nth-child(25) { animation-delay: 2.50s; } /* r */

/* Remove all handle-related styles */
.slot-handle, 
.handle-knob, 
.handle-arm, 
.handle-mount {
    display: none;
}

@keyframes pullDown {
    0% { transform: translateY(0) rotate(0deg); }
    30% { transform: translateY(40px) rotate(0deg); }
    60% { transform: translateY(80px) rotate(0deg); }
    80% { transform: translateY(70px) rotate(0deg); }
    100% { transform: translateY(75px) rotate(0deg); }
}

/* Button to open the sidebar */
.openbtn {
    font-size: 20px;
    cursor: pointer;
    background: linear-gradient(145deg, rgba(76, 175, 80, 0.8), rgba(56, 142, 60, 0.9));
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1001;
    display: none;
    justify-self: end;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.openbtn:hover {
    background: linear-gradient(145deg, rgba(76, 175, 80, 1), rgba(56, 142, 60, 1));
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.openbtn:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
    background: linear-gradient(145deg, rgba(76, 175, 80, 1), rgba(56, 142, 60, 1));
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

/* Visibility class for open button */
.openbtn.visible {
    display: block;
}

/* Match welcome screen colors when user is not logged in - applies to all pages */
.dsm-user-not-logged-in .openbtn {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
}

.dsm-user-not-logged-in .openbtn:hover {
    background: linear-gradient(135deg, #1E88E5, #1565C0);
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.5);
}

.dsm-user-not-logged-in .openbtn:focus-visible {
    outline: 2px solid #2196F3;
    background: linear-gradient(135deg, #1E88E5, #1565C0);
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.5);
}

/* Content wrapper positioning - adjusted to be closer to header */
.dsm-content-wrapper {
    margin-left: 250px; /* Reduced from 280px to match sidebar width */
    max-width: calc(100vw - 250px); /* Prevent horizontal overflow */
    width: calc(100% - 250px); /* Simplified width calculation */
    transition: margin-left 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    margin-top: 0; /* Ensure no extra space at top */
    box-sizing: border-box; /* Include padding and border in width calculation */
    overflow-x: hidden; /* Prevent horizontal scroll within content */
}

/* Prevent shifting below 1200px */
@media screen and (max-width: 1200px) {
    .dsm-site-header {
        margin-left: 0;
        width: 100%;
        left: 0;
    }
    
    .dsm-content-wrapper {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
    }
    
    /* Sidebar becomes overlay below 1200px */
    .sidebar {
        width: 0;
        z-index: 1000;
    }
    
    .sidebar.open {
        width: 250px;
    }
    
    .sidebar .closebtn {
        display: block;
    }
    
    .openbtn {
        display: block;
    }
}

/* Media queries for mobile layout */
@media screen and (max-width: 1900px) and (min-width: 1201px) {
    .sidebar {
        width: 0;
    }
    
    .sidebar .closebtn {
        display: block;
    }
    
    .openbtn {
        display: block;
    }
    
    .dsm-site-header {
        width: 100%;
        left: 0;
        margin-left: 0; /* Reset margin on mobile */
    }
    
    body.sidebar-open .dsm-site-header {
        left: 0;
        margin-left: 250px; /* Account for open sidebar */
        width: calc(100% - 250px);
    }
    
    .dsm-content-wrapper {
        margin-left: 20px;
        width: calc(100% - 40px);
        max-width: calc(100vw - 40px);
    }
    
    body.sidebar-open .dsm-content-wrapper {
        margin-left: 250px;
        width: calc(100% - 250px);
        max-width: calc(100vw - 250px);
    }
}

@media screen and (max-width: 480px) {

}

/* Logout container styling */
.sidebar .logout-container {
    justify-content: space-between;
    display: flex;
    align-items: center;
    position: relative;
    background: rgba(0, 0, 0, 0.1);
    margin-top: auto;
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Logout button styling */
.sidebar .logoutbtn {
    font-size: 14px;
    color: var(--timer-text-color, #fff);
    border: none;
    padding: 10px 15px;
    height: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: linear-gradient(145deg, #d32f2f, #b71c1c);
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    /* Ensure logout button is properly focusable */
    outline: none;
}

.sidebar .logoutbtn:hover {
    background: linear-gradient(145deg, #f44336, #d32f2f);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Focus styles for logout button */
.sidebar .logoutbtn:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
    background: linear-gradient(145deg, #f44336, #d32f2f);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Ensure focus styles work with hover */
.sidebar .logoutbtn:hover:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
    background: linear-gradient(145deg, #f44336, #d32f2f);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Shortcode container styling */
.sidebar .shortcode-container {
    display: inline-block;
    vertical-align: middle;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Force proper document flow in sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
}

.sidebar > * {
    flex-shrink: 0;
}

/* Premium Subscribe Button positioning in sidebar - ensure it appears below settings */
.sidebar .premium-subscribe-button-container {
    position: relative !important;
    clear: both;
    margin-top: 0;
    padding-top: 70px;
    display: block !important;
    order: 999; /* Force to bottom */
    text-align: center;
}

/* Premium subscribe button styling */
.sidebar .premium-subscribe-button {
    position: relative;
    z-index: 1;
    margin-top: 0;
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.25);
    overflow: hidden;
    min-width: 120px;
    justify-content: center;
}

.sidebar .premium-subscribe-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.sidebar .premium-subscribe-button:hover::before {
    left: 100%;
}

.sidebar .premium-subscribe-button:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.sidebar .premium-subscribe-button:active {
    transform: translateY(0);
    transition: all 0.1s ease;
}

.sidebar .premium-subscribe-button.active-subscription {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.25);
}

.sidebar .premium-subscribe-button.active-subscription:hover {
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.sidebar .subscribe-icon {
    font-size: 16px;
}

.sidebar .subscribe-text {
    font-size: 13px;
    line-height: 1.2;
}

.sidebar .premium-current-status {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 10px;
    font-size: 12px;
}

.sidebar .premium-current-status p {
    margin: 2px 0;
    color: #4CAF50;
}

/* Theme system removed - using base default-dark styles only */

/* Blue theme for sidebar when user is not logged in */
.dsm-user-not-logged-in .sidebar a:hover {
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.2), rgba(33, 150, 243, 0));
    border-left: 3px solid #2196F3;
}

.dsm-user-not-logged-in .sidebar a:not(.closebtn):not(.logoutbtn):focus-visible {
    outline: 2px solid #2196F3;
    border-left: 3px solid #2196F3;
}

.dsm-user-not-logged-in .sidebar a:not(.closebtn):not(.logoutbtn):hover:focus-visible {
    border-left: 3px solid #2196F3;
    outline: 2px solid #2196F3;
}

.dsm-user-not-logged-in .sidebar:focus-visible {
    outline: 2px solid #2196F3;
}

.dsm-user-not-logged-in .sidebar button:focus-visible,
.dsm-user-not-logged-in .sidebar input:focus-visible,
.dsm-user-not-logged-in .sidebar select:focus-visible,
.dsm-user-not-logged-in .sidebar textarea:focus-visible {
    outline: 2px solid #2196F3;
}

.dsm-user-not-logged-in .sidebar .closebtn:focus-visible {
    outline: 2px solid #2196F3;
}

.dsm-user-not-logged-in .sidebar .closebtn:hover:focus-visible {
    outline: 2px solid #2196F3;
}

.dsm-user-not-logged-in .sidebar .premium-subscribe-button {
    background: linear-gradient(145deg, #2196F3, #1976D2);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.dsm-user-not-logged-in .sidebar .premium-subscribe-button:hover {
    background: linear-gradient(145deg, #1E88E5, #1565C0);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.dsm-user-not-logged-in .sidebar .premium-current-status {
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.dsm-user-not-logged-in .sidebar .premium-current-status p {
    color: #2196F3;
}

/* DSM Sidebar Plugin inline styles */
.sidebar-link-clean {
    text-decoration: none;
    color: inherit;
}

/* Prevent default space key scrolling when sidebar is focused */
body.sidebar-focused {
    overflow: hidden;
}