/* mobile-keyboard/mobileKeyboard.css */

.mobile-math-keyboard {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: #f5f5f5;
    border-top: 1px solid #ccc;
    padding: 5px;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    max-height: 80vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.mobile-math-keyboard.visible {
    display: block;
}

.keyboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 0 4px;
}

.keyboard-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    flex: 1;
    text-align: center;
}

.keyboard-close {
    background: #e0e0e0;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    font-weight: 500;
}

.keyboard-close:active {
    background: #d0d0d0;
}

.keyboard-submit {
    background: #90EE90;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    font-weight: 500;
}

.keyboard-submit:active {
    background: #7FDD7F;
}

.keyboard-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin-bottom: 6px;
}

/* Page 0 (Basic Math) uses 6 columns */
.keyboard-grid.page-0 {
    grid-template-columns: repeat(6, 1fr);
}

/* Page 1 (QWERTY) uses 10 columns for proper layout */
.keyboard-grid.page-1 {
    grid-template-columns: repeat(10, 1fr);
}

/* Spacer buttons - invisible but maintain grid spacing */
.keyboard-btn.spacer {
    background: transparent;
    border: none;
    pointer-events: none;
    cursor: default;
}

.keyboard-btn {
    background: white;
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    padding: 8px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    user-select: none;
    -webkit-user-select: none;
    transition: background 0.1s;
}

.keyboard-btn:active {
    background: #b3d9ff;
    border-color: #0066cc;
    transform: scale(0.95);
}

/* Enhanced visual feedback for button press */
.keyboard-btn.pressed {
    background: #b3d9ff;
    border-color: #0066cc;
    transform: scale(0.95);
}

.keyboard-btn.wide {
    grid-column: span 2;
}

.keyboard-btn.action {
    background: #0066cc;
    color: white;
    border-color: #0066cc;
    font-weight: 600;
}

.keyboard-btn.action:active {
    background: #0052a3;
}

.keyboard-btn.secondary {
    background: #f0f0f0;
    color: #666;
}

.keyboard-btn.secondary:active {
    background: #b3d9ff;
    transform: scale(0.95);
}

.keyboard-btn.secondary.pressed {
    background: #b3d9ff;
    transform: scale(0.95);
}

/* Special rendering for math symbols */
.keyboard-btn .math-symbol {
    font-family: 'Times New Roman', serif;
    font-size: 20px;
}

/* Page indicator */
.keyboard-pages {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}

.keyboard-page-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
}

.keyboard-page-dot.active {
    background: #0066cc;
}

/* Swipe indicator (optional) */
.keyboard-swipe-hint {
    text-align: center;
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding-bottom: 4px;
}

/* Ensure keyboard doesn't cover input when screen is small */
@media (max-height: 600px) {
    .mobile-math-keyboard {
        max-height: 40vh;
    }
}

/* Extra small screens - keep original responsive behavior */
@media (max-width: 599px) {
    .mobile-math-keyboard {
        width: 100%;
    }
}

/* Tablet screens (600px+) - center with generous padding for page 2 */
@media (min-width: 600px) {
    .mobile-math-keyboard {
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        right: auto;
        padding-left: 8px;
        padding-right: 8px;
        border-left: 1px solid #ccc;
        border-right: 1px solid #ccc;
    }

    .keyboard-btn {
        min-height: 40px;
        font-size: 18px;
        padding: 8px;
    }
}

/* Medium screens (900px+) */
@media (min-width: 900px) {
    .keyboard-btn {
        min-height: 56px;
        font-size: 22px;
        padding: 12px;
    }

    .keyboard-grid {
        gap: 8px;
    }
}

/* Large screens (1200px+) */
@media (min-width: 1200px) {
    .keyboard-btn {
        min-height: 60px;
        font-size: 24px;
        padding: 14px;
    }

    .keyboard-grid {
        gap: 10px;
    }

    .keyboard-header {
        padding: 0 8px;
        margin-bottom: 10px;
    }

    .keyboard-title {
        font-size: 16px;
    }
}

/* Page transition animations */

/* Keyframe animations for sliding and fading */
@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-100%);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animation classes applied to keyboard grid */
.keyboard-grid {
    animation-duration: 150ms;
    animation-timing-function: ease-in-out;
    animation-fill-mode: forwards;
}

.keyboard-grid.animate-exit-left {
    animation-name: slideOutLeft;
}

.keyboard-grid.animate-exit-right {
    animation-name: slideOutRight;
}

.keyboard-grid.animate-enter-from-left {
    animation-name: slideInFromLeft;
}

.keyboard-grid.animate-enter-from-right {
    animation-name: slideInFromRight;
}

/* Initial state for entering pages - start hidden */
.keyboard-grid.animate-enter-from-left,
.keyboard-grid.animate-enter-from-right {
    opacity: 0;
}

