/* Guest overlay modals (register, create, warning, logout) */

/* Modal Overlay - matches timer-edit-modal-overlay */
.dsm-guest-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100050;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.4s ease;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    margin: 0;
}

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

/* Modal Container - matches timer-edit-modal */
.dsm-guest-modal-overlay .timer-edit-modal {
    background: linear-gradient(145deg, #2d2d2d, #262626);
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: scaleIn 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Modal Header */
.dsm-guest-modal-overlay .timer-edit-modal-header {
    background: linear-gradient(145deg, #333, #2a2a2a);
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dsm-guest-modal-overlay .timer-edit-modal-header h3 {
    margin: 0;
    color: #4dabf7;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(77, 171, 247, 0.3);
}

/* Close Button */
.dsm-guest-modal-overlay .timer-edit-modal-close {
    background: none;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.dsm-guest-modal-overlay .timer-edit-modal-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Modal Body */
.dsm-guest-modal-overlay .timer-edit-modal-body {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    flex: 1;
}

/* Ensure content inside modal body can scroll */
.dsm-guest-modal-overlay .timer-edit-modal-body > div {
    max-height: 100%;
}

/* Custom scrollbar for webkit browsers */
.dsm-guest-modal-overlay .timer-edit-modal-body::-webkit-scrollbar {
    width: 8px;
}

.dsm-guest-modal-overlay .timer-edit-modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.dsm-guest-modal-overlay .timer-edit-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.dsm-guest-modal-overlay .timer-edit-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Guest-specific content styling */
.dsm-guest-modal-content {
    text-align: center;
}

.dsm-guest-modal-icon {
    font-size: 48px;
    color: #f39c12;
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(243, 156, 18, 0.4);
}

.dsm-guest-modal-subtitle {
    color: #e74c3c;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 20px 0;
}

.dsm-guest-warning {
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
    text-align: left;
}

.dsm-guest-warning strong {
    color: #e74c3c;
}

.dsm-guest-benefits {
    background: rgba(77, 171, 247, 0.1);
    border: 1px solid rgba(77, 171, 247, 0.2);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}

.dsm-guest-benefits h4 {
    color: #4dabf7;
    margin: 0 0 15px 0;
    font-size: 16px;
    text-align: center;
}

.dsm-guest-benefits ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.dsm-guest-benefits li {
    margin: 10px 0;
    color: #ccc;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.dsm-guest-benefits li i {
    color: #51cf66;
    margin-top: 3px;
    flex-shrink: 0;
}

.dsm-guest-benefits li strong {
    color: #fff;
}

.dsm-guest-modal-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 25px;
}

.dsm-guest-btn {
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.dsm-guest-btn-primary {
    background: linear-gradient(45deg, #4dabf7, #339af0);
    color: #fff;
    box-shadow: 0 4px 15px rgba(77, 171, 247, 0.3);
}

.dsm-guest-btn-primary:hover {
    background: linear-gradient(45deg, #339af0, #228be6);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(77, 171, 247, 0.4);
    color: #fff;
}

.dsm-guest-btn-secondary {
    background: transparent;
    color: #888;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.dsm-guest-btn-secondary:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

/* Guest warning modal — stacked actions + distinct button treatments */
.dsm-guest-warning-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.dsm-guest-warning-actions .dsm-guest-btn {
    width: 100%;
    box-sizing: border-box;
    min-height: 48px;
}

#dsm-guest-warning-modal .dsm-guest-proceed-anyway {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    color: #1a1a1a !important;
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

#dsm-guest-warning-modal .dsm-guest-proceed-anyway:hover {
    background: linear-gradient(145deg, #ffffff, #f1f3f5);
    transform: translateY(-1px);
    color: #111 !important;
}

#dsm-guest-warning-modal .dsm-guest-btn-highlight-green {
    background: linear-gradient(45deg, #51cf66, #37b24d) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 4px 16px rgba(64, 192, 87, 0.45);
}

#dsm-guest-warning-modal .dsm-guest-btn-highlight-green:hover {
    background: linear-gradient(45deg, #40c057, #2f9e44) !important;
    color: #fff !important;
    transform: translateY(-2px);
}

#dsm-guest-warning-modal .dsm-guest-btn-ghost {
    background: transparent !important;
    border: 1px solid #5c5c5c !important;
    color: #c0c0c0 !important;
}

#dsm-guest-warning-modal .dsm-guest-btn-ghost:hover {
    border-color: #888 !important;
    color: #fff !important;
    background: rgba(255, 255, 255, 0.06) !important;
}

.dsm-guest-dont-show {
    margin-top: 15px;
    text-align: center;
}

.dsm-guest-dont-show label {
    color: #888;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dsm-guest-dont-show input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #4dabf7;
}

.dsm-guest-modal-note {
    text-align: center;
    color: #888;
    font-size: 13px;
    margin-top: 15px;
}

.dsm-guest-modal-note i {
    color: #4dabf7;
}

/* Form Styles for Registration Modal */
.dsm-guest-form {
    margin-top: 15px;
}

.dsm-guest-form-group {
    margin-bottom: 18px;
    text-align: left;
}

.dsm-guest-form-group label {
    display: block;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.dsm-guest-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 14px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.dsm-guest-input:focus {
    outline: none;
    border-color: #4dabf7;
    box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.2);
}

.dsm-guest-input::placeholder {
    color: #666;
}

.dsm-guest-help {
    display: block;
    color: #888;
    font-size: 12px;
    margin-top: 5px;
}

.dsm-guest-form-actions {
    margin-top: 25px;
}

.dsm-guest-form-error {
    font-size: 14px;
}

/* Loading spinner animation */
@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spin {
    animation: fa-spin 1s linear infinite;
}

/* Specific fix for registration modal scrolling */
#dsm-guest-register-modal .timer-edit-modal-body {
    overflow-y: auto !important;
    max-height: calc(90vh - 80px) !important;
}

#dsm-guest-register-modal .dsm-guest-register-content,
#dsm-guest-register-modal .dsm-guest-merge-prompt,
#dsm-guest-register-modal .dsm-guest-success {
    max-height: 100%;
    overflow-y: visible;
}

/* Registration modal: centered overlay; scroll inside dialog */
#dsm-guest-register-modal.dsm-guest-modal-overlay {
    overflow-y: auto;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

#dsm-guest-register-modal.dsm-guest-modal-overlay .timer-edit-modal {
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#dsm-guest-register-modal.dsm-guest-modal-overlay .timer-edit-modal-body {
    flex: 1;
    min-height: 0;
}

/* Specific fix for guest warning modal scrolling */
#dsm-guest-warning-modal .timer-edit-modal-body {
    overflow-y: auto !important;
    max-height: calc(90vh - 80px) !important;
}

#dsm-guest-warning-modal .dsm-guest-warning,
#dsm-guest-warning-modal .dsm-guest-benefits {
    max-height: 100%;
    overflow-y: visible;
}

/* Guest warning: centered; tall content scrolls inside the card */
#dsm-guest-warning-modal.dsm-guest-modal-overlay {
    overflow-y: auto;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
}

#dsm-guest-warning-modal.dsm-guest-modal-overlay .timer-edit-modal {
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: auto;
}

#dsm-guest-warning-modal.dsm-guest-modal-overlay .timer-edit-modal-body {
    flex: 1;
    min-height: 0;
}

/* Guest User Disabled Settings Styling */
.guest-disabled .toggle-button {
    opacity: 0.5;
    cursor: not-allowed;
}

.guest-disabled-section {
    opacity: 0.8;
}

.guest-disabled-section .setting-item {
    pointer-events: none;
    opacity: 0.6;
}

.guest-notice a {
    text-decoration: underline;
    transition: color 0.2s ease;
}

.guest-notice a:hover {
    color: #74c0fc;
}

/* Sidebar: Login/Register (anonymous guest) or Create Account (legacy WP guest) */
.sidebar .create-account-btn {
    background: linear-gradient(135deg, #000000, #40c057) !important;
    color: #fff !important;
    font-weight: 700 !important;
    box-shadow: 0 0 15px rgba(81, 207, 102, 0.5), 0 4px 15px rgba(81, 207, 102, 0.3) !important;
    border: 2px solid #51cf66 !important;
    animation: guest-create-account-pulse 2s infinite;
    position: relative;
    overflow: hidden;
}

.sidebar .create-account-btn:hover {
    background: linear-gradient(135deg, #40c057, #37b24d) !important;
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(81, 207, 102, 0.7), 0 6px 20px rgba(81, 207, 102, 0.4) !important;
}

.sidebar .create-account-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: guest-create-account-shine 3s infinite;
}

@keyframes guest-create-account-pulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(81, 207, 102, 0.5), 0 4px 15px rgba(81, 207, 102, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(81, 207, 102, 0.8), 0 4px 20px rgba(81, 207, 102, 0.5);
    }
}

@keyframes guest-create-account-shine {
    0% {
        left: -100%;
    }
    50%, 100% {
        left: 100%;
    }
}

/* Add icon to the button */
.sidebar .create-account-btn::after {
    content: ' \f067';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-left: 8px;
}

/*
 * Dual class stack (.dsm-guest-modal-overlay.timer-edit-modal-overlay):
 * Some themes / WP resets / merge order drop single-class guest rules.
 * These selectors mirror the overlay + inner card + native <button> reset.
 */
#dsm-guest-warning-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay,
#dsm-guest-create-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay,
#dsm-guest-register-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay,
#dsm-guest-logout-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
    z-index: 100050;
    overflow-x: hidden;
    overflow-y: auto;
    backdrop-filter: blur(8px);
}

#dsm-guest-warning-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay > .timer-edit-modal,
#dsm-guest-create-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay > .timer-edit-modal,
#dsm-guest-register-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay > .timer-edit-modal,
#dsm-guest-logout-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay > .timer-edit-modal {
    flex-shrink: 0;
    width: 90%;
    max-width: 500px;
}

/* Native <button> reset inside guest overlays (WP / block themes often zero these) */
#dsm-guest-warning-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay button.dsm-guest-btn,
#dsm-guest-create-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay button.dsm-guest-btn,
#dsm-guest-register-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay button.dsm-guest-btn,
#dsm-guest-logout-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay button.dsm-guest-btn {
    -webkit-appearance: none;
    appearance: none;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.3;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

#dsm-guest-warning-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay .dsm-guest-warning-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

#dsm-guest-warning-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay .dsm-guest-proceed-anyway {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    color: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

#dsm-guest-warning-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay .dsm-guest-proceed-anyway:hover {
    background: linear-gradient(145deg, #ffffff, #f1f3f5);
    color: #111;
    transform: translateY(-1px);
}

#dsm-guest-warning-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay .dsm-guest-btn-highlight-green {
    background: linear-gradient(45deg, #51cf66, #37b24d);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(64, 192, 87, 0.45);
}

#dsm-guest-warning-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay .dsm-guest-btn-highlight-green:hover {
    background: linear-gradient(45deg, #40c057, #2f9e44);
    color: #fff;
    transform: translateY(-2px);
}

#dsm-guest-warning-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay .dsm-guest-btn-ghost {
    background: transparent;
    border: 1px solid #5c5c5c;
    color: #c0c0c0;
}

#dsm-guest-warning-modal.dsm-guest-modal-overlay.timer-edit-modal-overlay .dsm-guest-btn-ghost:hover {
    border-color: #888;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

/* Responsive */
@media (max-width: 480px) {
    .dsm-guest-modal-overlay .timer-edit-modal {
        width: 95%;
        margin: 10px;
    }

    .dsm-guest-modal-overlay .timer-edit-modal-body {
        padding: 20px;
    }

    .dsm-guest-benefits li {
        font-size: 13px;
    }

    .dsm-guest-input {
        padding: 10px 12px;
    }
}
