/* Modern Frontend Styles */
#pl-practice-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 15px;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d2d50 100%);
    min-height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Login Form Styles */
.pl-login-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px 20px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.pl-login-container h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-weight: 300;
    font-size: 28px;
}

.pl-login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pl-form-group {
    display: flex;
    flex-direction: column;
}

.pl-form-group label {
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.pl-form-group input {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
    box-sizing: border-box;
    width: 100%;
}

.pl-form-group input:focus {
    outline: none;
    border-color: #4f46e5;
    background: white;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

.pl-login-btn {
    padding: 15px;
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    width: 100%;
}

.pl-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.pl-login-btn:active {
    transform: translateY(0);
}

/* Practice Container Styles */
#pl-practice-container > h2 {
    color: white;
    text-align: center;
    font-size: clamp(24px, 5vw, 32px);
    font-weight: 300;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    line-height: 1.3;
}

#pl-current-time {
    color: rgba(255,255,255,0.9);
    text-align: center;
    display: block;
    font-size: clamp(14px, 3vw, 16px);
    margin-bottom: 30px;
    line-height: 1.4;
}

/* Practice Notes */
#pl-practice-container label[for="pl-practice-note"] {
    color: white;
    font-weight: 500;
    margin-bottom: 10px;
    display: block;
    font-size: clamp(14px, 3vw, 16px);
}

#pl-practice-note {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 15px;
    background: rgba(255,255,255,0.95);
    font-size: 16px;
    resize: vertical;
    min-height: 100px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

#pl-practice-note:focus {
    outline: none;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

/* Timer Section */
#pl-timer {
    background: rgba(255,255,255,0.95);
    padding: 20px 15px;
    border-radius: 20px;
    text-align: center;
    margin: 25px 0;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

#pl-timer-display {
    font-size: clamp(32px, 8vw, 48px);
    font-weight: 200;
    color: #333;
    font-family: 'Courier New', monospace;
    margin-bottom: 20px;
    display: block;
    letter-spacing: 2px;
}

/* Timer Buttons */
.timer-controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    justify-content: center;
}

.timer-btn {
    padding: 14px 10px;
    border: none;
    border-radius: 10px;
    font-size: clamp(12px, 3vw, 14px);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.timer-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

#pl-start-btn {
    background: linear-gradient(135deg, #1e7e34 0%, #28a745 100%);
    color: white;
    grid-column: 1 / -1;
}

#pl-pause-btn {
    background: linear-gradient(135deg, #ff9800 0%, #e68900 100%);
    color: white;
}

#pl-stop-btn {
    background: linear-gradient(135deg, #f44336 0%, #da190b 100%);
    color: white;
}

#pl-reset-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: white;
}

.timer-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 20px 0;
}

.action-btn {
    padding: 16px 20px;
    border: none;
    border-radius: 10px;
    font-size: clamp(14px, 3vw, 16px);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#pl-save-log-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: white;
}

#pl-show-logs-btn {
    background: linear-gradient(135deg, #607D8B 0%, #455A64 100%);
    color: white;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.action-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* Past Logs */
#pl-past-logs {
    background: rgba(255,255,255,0.95);
    padding: 20px 15px;
    border-radius: 15px;
    margin: 20px 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow-x: auto;
}

#pl-past-logs table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    min-width: 500px;
}

#pl-past-logs th {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: white;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    font-size: clamp(12px, 3vw, 14px);
    white-space: nowrap;
}

#pl-past-logs td {
    padding: 12px 10px;
    border-bottom: 1px solid #eee;
    font-size: clamp(12px, 3vw, 14px);
    word-break: break-word;
}

#pl-past-logs tr:hover {
    background: #f8f9fa;
}

/* Calendar Section */
.calendar-section {
    margin: 30px 0;
}

#pl-practice-container > .calendar-section > h3 {
    color: white;
    text-align: center;
    font-size: clamp(20px, 4vw, 24px);
    font-weight: 300;
    margin: 0 0 20px 0;
}

.calendar-controls {
    text-align: center;
    margin-bottom: 15px;
}

.calendar-controls label {
    color: white;
    font-size: clamp(14px, 3vw, 16px);
    margin-right: 10px;
}

#pl-calendar-date {
    background: white;
    border: none;
    padding: 12px;
    border-radius: 10px;
    width: 150px;
    text-align: center;
    font-size: 14px;
    max-width: 100%;
    box-sizing: border-box;
}

.responsive-calendar {
    background: white;
    border-radius: 15px;
    padding: 15px 10px;
    margin: 15px 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow-x: auto;
}

#pl-month-calendar table {
    width: 100%;
    border-collapse: collapse;
    min-width: 300px;
}

#pl-month-calendar th {
    padding: clamp(8px, 2vw, 12px);
    text-align: center;
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: white;
    font-weight: 600;
    font-size: clamp(10px, 2.5vw, 12px);
    white-space: nowrap;
}

#pl-month-calendar td {
    padding: clamp(10px, 2.5vw, 15px);
    text-align: center;
    border: 1px solid #e0e0e0;
    font-size: clamp(11px, 2.5vw, 14px);
    min-width: 30px;
    height: clamp(30px, 8vw, 45px);
    box-sizing: border-box;
}

#pl-calendar-msg {
    color: rgba(255,255,255,0.9);
    text-align: center;
    font-style: italic;
    margin-top: 10px;
    font-size: clamp(12px, 3vw, 14px);
    line-height: 1.4;
}

/* Pagination */
#pl-pagination, .pl-day-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pl-page-btn, .pl-day-page-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: #4f46e5;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(12px, 3vw, 14px);
    min-width: 40px;
}

.pl-page-btn:hover:not(:disabled), .pl-day-page-btn:hover:not(:disabled) {
    background: #3730a3;
    transform: translateY(-1px);
}

.pl-page-btn:disabled, .pl-day-page-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Error Message */
.pl-error-message {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    border-left: 4px solid #c62828;
    font-size: clamp(14px, 3vw, 16px);
}

.pl-success-message {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    border-left: 4px solid #4caf50;
    font-size: clamp(14px, 3vw, 16px);
}

/* Student Day Modal Styles */
#pl-student-day-modal {
    z-index: 10000;
}

/* #pl-student-day-modal > div {
    animation: modalSlideIn 0.3s ease-out;
    max-width: 90%;
    width: 600px;
} */

#pl-student-day-logs-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    min-width: 400px;
}

#pl-student-day-logs-content th {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: white;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    font-size: clamp(12px, 3vw, 14px);
}

#pl-student-day-logs-content td {
    padding: 12px 10px;
    border-bottom: 1px solid #eee;
    font-size: clamp(12px, 3vw, 14px);
}

/* Mobile-First Responsive Design */
@media (max-width: 480px) {
    #pl-practice-container {
        padding: 15px 10px;
    }
    
    .pl-login-container {
        margin: 30px auto;
        padding: 25px 15px;
    }
    
    .timer-controls {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .timer-btn {
        min-height: 45px;
        padding: 12px 8px;
    }
    
    #pl-start-btn {
        grid-column: 1;
    }
    
    .action-btn {
        min-height: 50px;
        padding: 14px 15px;
    }
    
    #pl-past-logs, #pl-student-day-logs-content {
        padding: 15px 10px;
    }
    
    #pl-past-logs table, #pl-student-day-logs-content table {
        min-width: 400px;
    }
    
    #pl-past-logs th, #pl-past-logs td,
    #pl-student-day-logs-content th, #pl-student-day-logs-content td {
        padding: 10px 8px;
    }
    
    .responsive-calendar {
        padding: 10px 5px;
    }
    
    #pl-month-calendar th, #pl-month-calendar td {
        padding: 6px 3px;
        min-width: 25px;
        height: 35px;
        font-size: 11px;
    }
    
    #pl-student-day-modal > div {
        width: 95%;
        margin: 20px auto;
        padding: 15px;
    }
    
    .pl-day-pagination {
        gap: 4px;
    }
    
    .pl-day-page-btn {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 35px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .timer-controls {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #pl-start-btn {
        grid-column: 1 / -1;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    #pl-student-day-modal > div {
        width: 90%;
        margin: 30px auto;
    }
}

@media (min-width: 769px) {
    .timer-controls {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
    }
    
    #pl-start-btn {
        grid-column: 1;
    }
    
    .action-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #pl-practice-container {
        padding: 30px 20px;
    }
}

/* Animation for timer */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.timer-running #pl-timer-display {
    animation: pulse 2s infinite;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .timer-btn:active,
    .action-btn:active,
    .pl-page-btn:active,
    .pl-day-page-btn:active {
        transform: scale(0.98);
    }
    
    .timer-btn:hover,
    .action-btn:hover,
    .pl-page-btn:hover,
    .pl-day-page-btn:hover {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #pl-practice-container {
        background: #1a1a2e;
    }
    
    .timer-btn, .action-btn {
        border: 2px solid white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .timer-btn, .action-btn {
        transition: none;
    }
    
    .timer-running #pl-timer-display {
        animation: none;
    }
    
    #pl-past-logs {
        transition: none;
    }
    
    #pl-student-day-modal > div {
        animation: none;
    }
}

/* Sound Control Button */
.pl-sound-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #1e7e34 0%, #28a745 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.pl-sound-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.pl-sound-btn:active {
    transform: translateY(0);
}

/* Calendar day hover effects */
#pl-month-calendar td[data-date]:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Inline Note Editing Styles */
.pl-note-cell {
    position: relative;
    min-width: 200px;
}

.pl-note-display {
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.pl-note-display:hover {
    background-color: #f0f0f0;
}

.pl-note-edit {
    font-family: inherit;
    border: 2px solid #4f46e5 !important;
    box-shadow: 0 0 0 1px rgba(79,70,229,0.15);
}

.pl-note-edit:focus {
    outline: none;
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.10) !important;
}

/* Edit/Save/Cancel Buttons */
.pl-edit-note-btn, .pl-save-note-btn, .pl-cancel-note-btn {
    transition: all 0.2s ease;
    border: none;
    border-radius: 4px;
    font-size: 11px !important;
    padding: 3px 6px !important;
    margin: 1px !important;
}

.pl-edit-note-btn {
    background: #4f46e5;
    color: white;
}

.pl-edit-note-btn:hover {
    background: #3730a3;
    transform: translateY(-1px);
}

.pl-save-note-btn {
    background: #4CAF50;
    color: white;
}

.pl-save-note-btn:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-1px);
}

.pl-cancel-note-btn {
    background: #f44336;
    color: white;
}

.pl-cancel-note-btn:hover {
    background: #da190b;
    transform: translateY(-1px);
}

/* Practice Target Button Styles */
.pl-target-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.pl-target-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.pl-target-btn:active {
    transform: translateY(0);
}

/* Practice Target Modal - Raised to Top */
#pl-student-target-modal > div {
    position: fixed !important;
    top: 0 !important;
    margin: 20px auto !important;
    max-height: 90vh !important;
}

/* Ensure it stays at top on all screen sizes */
@media (max-width: 768px) {
    #pl-student-target-modal > div {
        margin: 15px auto !important;
        max-height: 95vh !important;
    }
}

@media (max-width: 480px) {
    #pl-student-target-modal > div {
        margin: 10px auto !important;
        max-height: 95vh !important;
    }
}

/* Responsive adjustments for editing buttons */
@media (max-width: 480px) {
    .pl-edit-note-btn, .pl-save-note-btn, .pl-cancel-note-btn {
        font-size: 10px !important;
        padding: 2px 4px !important;
        margin: 1px 0 !important;
        display: block;
        width: 100%;
        margin-bottom: 2px !important;
    }
    
    .pl-note-cell {
        min-width: 150px;
    }
}

/* Loading spinner for save buttons */
.pl-note-cell .spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    display: inline-block;
    margin-right: 5px;
    vertical-align: middle;
}


/* Passcode toggle styles */
.pl-form-group div[style*="position: relative"] {
    position: relative;
}

#pl-toggle-passcode {
    background: none;
    border: none;
    padding: 5px;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

#pl-toggle-passcode:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

#pl-toggle-passcode:active {
    background-color: rgba(0, 0, 0, 0.2);
}

/* Ensure the input field has enough padding for the icon */
#passcode {
    box-sizing: border-box;
}


/* Metronome button styles */
.pl-metronome-btn {
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.pl-metronome-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.pl-metronome-btn:active {
    transform: translateY(0);
}


#pl-student-day-logs-content h4{display:none;}


/* Progress Modal Styles - Fixed Version */
#pl-progress-modal {
    z-index: 10000 !important;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0,0,0,0.8) !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: auto !important;
}

#pl-progress-modal > div {
    animation: modalSlideIn 0.3s ease-out;
    border: none !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: white !important;
    padding: 30px !important;
    border-radius: 15px !important;
    max-width: 500px !important;
    width: 90% !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1) !important;
    margin: 0 !important;
}

#pl-progress-modal h3 {
    color: #333;
    font-weight: 600;
    margin: 0;
}

/* Plain close button - no colors */
#pl-close-progress-modal {
    background: #f8f9fa !important;
    border: 1px solid #ddd !important;
    color: #333 !important;
    padding: 8px 16px !important;
    font-size: 14px !important;
    border-radius: 5px !important;
    cursor: pointer !important;
}

#pl-close-progress-modal:hover {
    background: #e9ecef !important;
    border-color: #adb5bd !important;
}

/* Progress Button Styles */
.pl-progress-btn {
    background: linear-gradient(135deg, #1e7e34 0%, #28a745 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(30,126,52,0.25);
    min-height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pl-progress-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30,126,52,0.35);
}

.pl-progress-btn:active {
    transform: translateY(0);
}

/* Ensure overlay covers entire screen */
#pl-progress-modal::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: -1;
}

/* Responsive Design for Progress Modal */
@media (max-width: 768px) {
    #pl-progress-modal > div {
        width: 95%;
        padding: 25px 20px;
    }
    
    #pl-progress-modal h3 {
        font-size: 20px;
    }
    
    .pl-progress-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    #pl-progress-modal > div {
        width: 95%;
        padding: 20px 15px;
    }
    
    #pl-progress-modal h3 {
        font-size: 18px;
    }
    
    #pl-progress-modal > div > div:first-child {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    #pl-progress-modal > div > div:first-child h3 {
        margin-bottom: 5px;
    }
    
    .pl-progress-btn {
        padding: 8px 14px;
        font-size: 12px;
    }
}

/* Modal animation */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #pl-progress-modal > div {
        border: 2px solid #333 !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    #pl-progress-modal > div {
        animation: none;
    }
    
    .pl-progress-btn {
        transition: none;
    }
}

/* Milestones Modal Styles - Fixed Full Screen Overlay */
#pl-milestones-modal {
    z-index: 10000 !important;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0,0,0,0.8) !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: auto !important;
}

#pl-milestones-modal > div {
    animation: modalSlideIn 0.3s ease-out;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: white !important;
    padding: 30px !important;
    border-radius: 15px !important;
    max-width: 600px !important;
    width: 90% !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1) !important;
    margin: 0 !important;
}

/* Ensure overlay covers entire screen */
#pl-milestones-modal::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: -1;
}

/* Milestones Button Styles */
.pl-milestones-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    min-height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pl-milestones-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.pl-milestones-btn:active {
    transform: translateY(0);
}

#pl-close-milestones-modal {
    background: #f8f9fa !important;
    border: 1px solid #ddd !important;
    color: #333 !important;
}

#pl-close-milestones-modal:hover {
    background: #e9ecef !important;
}

/* Responsive Design for Milestones Modal */
@media (max-width: 768px) {
    #pl-milestones-modal > div {
        width: 95%;
        padding: 25px 20px !important;
    }
    
    #pl-milestones-modal h3 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    #pl-milestones-modal > div {
        width: 95%;
        padding: 20px 15px !important;
    }
    
    #pl-milestones-modal h3 {
        font-size: 18px;
    }
    
    #pl-milestones-modal > div > div:first-child {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    #pl-milestones-modal > div > div:first-child h3 {
        margin-bottom: 5px;
    }
}

/* Modal animation */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #pl-milestones-modal > div {
        border: 2px solid #333 !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    #pl-milestones-modal > div {
        animation: none;
    }
    
    .pl-milestones-btn {
        transition: none;
    }
}

/* Timeout Modal Styles */
#pl-timeout-modal {
    animation: fadeIn 0.3s ease-out;
}

.pl-timeout-btn {
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
}

.pl-timeout-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3) !important;
}

.pl-timeout-btn:active {
    transform: translateY(0) !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive timeout modal */
@media (max-width: 480px) {
    #pl-timeout-modal > div {
        padding: 30px 20px !important;
    }
    
    #pl-timeout-modal h3 {
        font-size: 20px !important;
    }
    
    #pl-timeout-modal p {
        font-size: 14px !important;
    }
    
    .pl-timeout-btn {
        padding: 12px 20px !important;
        font-size: 14px !important;
        min-width: 100px !important;
    }
}

/* ── Metronome modal ───────────────────────────────────────────── */
/* Desktop: centred absolute panel, full 80vh iframe, close below. */
/* Mobile/tablet: scrollable overlay, responsive width, close below.*/

#pl-close-metronome {
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    transition: opacity .15s;
    min-height: 44px;
}
#pl-close-metronome:hover  { opacity: .88; }
#pl-close-metronome:active { opacity: .75; }

/* ── Mobile/tablet override (≤ 768px) ── */
@media (max-width: 768px) {
    /* Overlay becomes scrollable so nothing is cut off */
    #pl-metronome-modal {
        overflow-y: auto !important;
        padding: 16px !important;
        box-sizing: border-box !important;
    }
    /* Inner panel: full width, no absolute centring */
    #pl-metronome-inner {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: 100% !important;
        max-width: 480px !important;
        margin: 16px auto !important;
        box-sizing: border-box !important;
    }
    /* Reduce iframe height so close button is reachable without scrolling */
    #pl-metronome-content iframe {
        height: 62vh !important;
        min-height: 300px !important;
    }
}

/* ── Datepicker: centred modal on mobile/tablet (≤ 1024px) ─────── */
@media (max-width: 1024px) {
    /* Overlay behind the calendar so it reads as a modal */
    .ui-datepicker {
        position: fixed !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        z-index: 10000 !important;
        max-width: 88vw !important;
        box-shadow: 0 20px 60px rgba(0,0,0,.35) !important;
    }
    /* Darken the page behind the picker */
    .ui-widget-overlay,
    body.ui-datepicker-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 9999;
    }
}


/* ── PL Modal Loader Spinner ─────────────────────────────────────────── */
.pl-modal-loader { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:48px 24px; min-height:140px; gap:14px; }
.pl-spinner { width:40px; height:40px; border-radius:50%; border:3px solid rgba(79,70,229,.15); border-top-color:#4f46e5; animation:pl-spin .7s linear infinite; flex-shrink:0; }
.pl-spinner-label { font-size:13px; color:#888; font-family:'Segoe UI',Tahoma,sans-serif; }
@keyframes pl-spin { to { transform:rotate(360deg); } }
.pl-btn-spinner { display:inline-block; width:14px; height:14px; border-radius:50%; border:2px solid rgba(255,255,255,.35); border-top-color:#fff; animation:pl-spin .7s linear infinite; vertical-align:middle; margin-right:6px; }

/* ── Desktop / PC / Mac only (≥1025px) ──────────────────────────────
   When the hub runs full-viewport on desktop, its global rule
   .ch-pane #pl-practice-container { margin: 0; } overrides the base
   max-width:800px + margin:0 auto centering. Restore it here.       */
@media (min-width: 1025px) {
  #pl-practice-container {
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 800px;
    /* Allow vertical scroll within the pane without min-height:100vh
       fighting the fixed-height hub pane on desktop                  */
    min-height: unset;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   Forced Level Selection Modal
   Follows the Community Hub logout modal design pattern:
   - Dark semi-transparent backdrop with blur (shows hub UI behind)
   - Dark card with white text (matches --ch-bg-dark2 palette)
   - Cannot be dismissed — no close button, backdrop clicks blocked
   ══════════════════════════════════════════════════════════════════════ */

/* Outer wrapper — hidden by default, flex when .pl-choose-level-open */
.pl-choose-level-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999; /* above hub (9990) and all chat overlays */
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}
.pl-choose-level-modal.pl-choose-level-open {
    display: flex;
    animation: pl-cl-fade-in 0.25s ease;
}

/* Blurred dark backdrop — same opacity as hub logout modal */
.pl-choose-level-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Card — dark theme matching hub palette */
.pl-choose-level-content {
    position: relative; /* sits above overlay */
    z-index: 1;
    background: #2d2d50; /* --ch-bg-dark2 */
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 20px;
    padding: 36px 32px 32px;
    max-width: 440px;
    width: 92%;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.60);
    animation: pl-cl-slide-up 0.28s ease;
    text-align: center;
}

/* Emoji icon */
.pl-choose-level-icon {
    font-size: 52px;
    line-height: 1;
    margin-bottom: 18px;
    display: block;
}

/* Title */
.pl-choose-level-title {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 14px;
    line-height: 1.3;
}

/* Subtitle / message */
.pl-choose-level-message {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.6;
    margin: 0 0 26px;
}
.pl-choose-level-message strong {
    color: rgba(255, 255, 255, 0.90);
    font-weight: 600;
}

/* Label + select field */
.pl-choose-level-field {
    text-align: left;
    margin-bottom: 20px;
}
.pl-choose-level-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.70);
    margin-bottom: 8px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.pl-choose-level-select {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 15px;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    -webkit-appearance: none;
    appearance: none;
    /* custom chevron */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(255,255,255,0.5)' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}
.pl-choose-level-select:focus {
    outline: none;
    border-color: #818cf8;
    background-color: rgba(255, 255, 255, 0.13);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.22);
}
.pl-choose-level-select option {
    background: #2d2d50;
    color: #fff;
}

/* Error message */
.pl-choose-level-error {
    font-size: 13px;
    color: #ff6b7a;
    margin: 0 0 16px;
    text-align: left;
    padding: 10px 14px;
    background: rgba(220, 53, 69, 0.15);
    border-radius: 8px;
    border: 1px solid rgba(220, 53, 69, 0.25);
}

/* Action row */
.pl-choose-level-actions {
    display: flex;
    justify-content: center;
    margin-top: 4px;
}

/* Primary button — indigo gradient */
.pl-choose-level-btn {
    padding: 13px 32px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    cursor: pointer;
    transition: all 0.18s;
    min-height: 50px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.pl-choose-level-btn-primary {
    background: linear-gradient(135deg, #4f46e5, #3730a3);
    color: #ffffff;
    border: 1px solid rgba(79, 70, 229, 0.40);
    width: 100%;
}
.pl-choose-level-btn-primary:not(:disabled):hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.40);
}
.pl-choose-level-btn-primary:not(:disabled):active {
    transform: translateY(0);
}
.pl-choose-level-btn-primary:disabled {
    opacity: 0.40;
    cursor: not-allowed;
    transform: none !important;
}

/* Dismiss animation when level saved */
.pl-choose-level-modal:not(.pl-choose-level-open) {
    animation: pl-cl-fade-out 0.28s ease forwards;
}

/* Keyframes */
@keyframes pl-cl-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes pl-cl-fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}
@keyframes pl-cl-slide-up {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

/* Responsive — mobile */
@media (max-width: 480px) {
    .pl-choose-level-content {
        padding: 28px 20px 24px;
        border-radius: 16px;
    }
    .pl-choose-level-icon  { font-size: 40px; margin-bottom: 14px; }
    .pl-choose-level-title { font-size: 19px; }
    .pl-choose-level-message { font-size: 13px; }
}
