:root {
    --primary: #ff5e00;
    --secondary: #ff2a00;
    --accent: #ff9600;
    --background: #e0950a;
    --card-bg: #fff7e6;
    --text-light: #fff;
    --text-dark: #333;
    --success: #4CAF50;
    --error: #f44336;
    --key-bg: #f8f9fa;
    --key-pressed: #ff5e00;
    --key-stuck: #f44336;
    --key-border: #ddd;
}




.keyboard {
    background: var(--card-bg);
    padding: 18px 14px;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--accent);
    width: 100%;
    max-width: 1400px; /* matches .main-container */
    margin: 0 auto;
    overflow-x: auto; /* Enable horizontal scrolling */
}
.keyboard-layout {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: flex-end; /* This aligns all sections by their bottoms */
    position: relative;
    min-width: 1200px; /* Set a minimum width to trigger scrolling */
    align-items: flex-end; /* Align all sections to the bottom */
}

.main-section {
    flex: 0 0 auto;
}

.nav-section {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
}

 .numpad-section {
    width: 240px; 
    display: flex;
    flex-direction: column;
    margin-top: 60px;
  
}

.keyboard__row {
    display: flex;
    margin-bottom: 8px;
    justify-content: flex-start;
    gap: 4px;
}

.keyboard__row:last-child {
    margin-bottom: 0;
}

.main-section .keyboard__row {
    justify-content: space-between;
    gap: 0;
}

.key {
    background: var(--key-bg, #f8f9fa);
    border: 1px solid var(--key-border, #ddd);
    border-radius: 6px;
    color: var(--text-dark, #333);
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: 40px;
    min-width: 40px;
    position: relative;
}



/* Function Keys Row */
.keyboard__function-keys {
    margin-bottom: 15px;
}

.keyboard__function-keys .key {
    flex: 1;
    margin-right: 4px;
    min-width: 50px;
}

.keyboard__function-keys .key:last-child {
    margin-right: 0;
}

.keyboard__function-keys .key:first-child {
    font-weight: 600;
}

/* Number Row */
.keyboard__number-row .key {
    flex: 1;
    margin-right: 4px;
    min-width: 45px;
}

.keyboard__number-row .key:last-child {
    margin-right: 0;
}

.key--backspace {
    flex: 1.8 !important;
    font-weight: 600 !important;
}

/* QWER Row */
.keyboard__qwer-row .key {
    flex: 1;
    margin-right: 4px;
}

.keyboard__qwer-row .key:last-child {
    margin-right: 0;
}

.key--tab {
    flex: 1.5 !important;
    font-weight: 600 !important;
}

/* ASDF Row */
.keyboard__asdf-row .key {
    flex: 1;
    margin-right: 4px;
}

.keyboard__asdf-row .key:last-child {
    margin-right: 0;
}

.key--caps {
    flex: 1.8 !important;
    font-weight: 600 !important;
}

.key--enter {
    flex: 2.2 !important;
    font-weight: 600 !important;
}

/* ZXCV Row */
.keyboard__zxcv-row .key {
    flex: 1;
    margin-right: 4px;
}

.keyboard__zxcv-row .key:last-child {
    margin-right: 0;
}

.key--shift-left,
.key--shift-right {
    position: relative;
    padding-left: 5px;
}

.key--shift-left::before,
.key--shift-right::before {
    content: '⇧';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

.key--shift-left span,
.key--shift-right span {
    margin-left: 14px;
}

.key--shift-left {
    flex: 2.25 !important;
    font-weight: 600 !important;
}

.key--shift-right {
    flex: 2.75 !important;
    font-weight: 600 !important;
}

/* Spacebar Row */
.keyboard__spacebar-row .key {
    margin-right: 4px;
}

.keyboard__spacebar-row .key:last-child {
    margin-right: 0;
}

.keyboard__spacebar-row .key:nth-child(1),
.keyboard__spacebar-row .key:nth-child(2),
.keyboard__spacebar-row .key:nth-child(3) {
    flex: 1.25;
    font-weight: 600;
}

.keyboard__spacebar-row .key:nth-child(5),
.keyboard__spacebar-row .key:nth-child(6),
.keyboard__spacebar-row .key:nth-child(7) {
    flex: 1.25;
    font-weight: 600;
}

.key--spacebar {
    flex: 6 !important;
    position: relative;
}

.key--spacebar::after {
    content: '';
    position: absolute;
    width: 80%;
    height: 2px;
    background: #888;
    bottom: 15px;
    border-radius: 1px;
}

/* Navigation Section */
.nav-section {
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Align to bottom to match main keyboard */
}

.nav-top-keys {
            margin-bottom: 15px;
}

.nav-keys .key {
            width: 60px;
    font-weight: 600;
    font-size: 9px;
        }

    


/* Arrow Keys */
.arrow-keys {
    margin-top: 60px;
    width: 180px;
}

.arrow-keys .keyboard__row:first-child {
    justify-content: flex-start;
    margin-left: 60px; /* Align up arrow with down arrow */
}

.arrow-keys .keyboard__row:last-child {
    justify-content: flex-start;
}

.key--arrow {

    font-weight: 600 !important;
    width: 56px !important;
    font-size: 16px !important;
}

/* Numpad Styling */
.numpad-section {
    width: 220px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    
}

.numpad-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 4px 4px; /* 4px for column gap, 4px for row gap */
    row-gap: 8px; /* Override the row gap to match main keyboard */
    height: 100%;
    width: 100%;
}



.numpad-section .key {
    width: 100%;
    height: 100%;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}



.key--num-lock {
    font-size: 9px !important;
    grid-column: 1;
    grid-row: 1;
}

.key--num-divide {
    grid-column: 2;
    grid-row: 1;
}

.key--num-multiply {
    grid-column: 3;
    grid-row: 1;
}

.key--num-minus {
    grid-column: 4;
    grid-row: 1;
}

.key--num-7 {
    grid-column: 1;
    grid-row: 2;
}

.key--num-8 {
    grid-column: 2;
    grid-row: 2;
}

.key--num-9 {
    grid-column: 3;
    grid-row: 2;
}

.key--num-plus {
    grid-column: 4;
    grid-row: 2 / 4;
    height: auto;
}

.key--num-4 {
    grid-column: 1;
    grid-row: 3;
}

.key--num-5 {
    grid-column: 2;
    grid-row: 3;
}

.key--num-6 {
    grid-column: 3;
    grid-row: 3;
}

.key--num-1 {
    grid-column: 1;
    grid-row: 4;
}

.key--num-2 {
    grid-column: 2;
    grid-row: 4;
}

.key--num-3 {
    grid-column: 3;
    grid-row: 4;
}

.key--num-enter {
    grid-column: 4;
    grid-row: 4 / 6;
    height: auto;
}

.key--num-zero {
    grid-column: 1 / 3;
    grid-row: 5;
    width: auto;
}

.key--num-dot {
    grid-column: 3;
    grid-row: 5;
}



/* Special key indicators */
.key--caps::before {
    content: '⇪';
    font-size: 16px;
    position: absolute;
    top: 2px;
    left: 4px;
}

.key--enter::before {
    content: '⏎';
    font-size: 16px;
    position: absolute;
    top: 2px;
    right: 4px;
}

.key--tab::before {
    content: '⇥';
    font-size: 14px;
    position: absolute;
    top: 2px;
    left: 4px;
}

.key {
    /* Base key styles */
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

/* Pressed state - Green */
.key.pressed {
    background: #4CAF50 !important; /* Green */
    color: white !important;
    transform: translateY(2px);
    box-shadow: 0 2px 0 #2E7D32, 0 4px 8px rgba(0,0,0,0.2) !important;
}
@keyframes keyPress {
    0% { transform: translateY(0); }
    50% { transform: translateY(2px); }
    100% { transform: translateY(0); }
}

.key.pressed {
    background-color: #4CAF50 !important;
    color: white !important;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.8);
    position: relative;
    z-index: 10;
}

/* Tested state - Lighter green */
.key.tested {
    background: #81C784 !important; /* Light green */
    color: #1B5E20 !important;
}

/* Stuck state - Red */
.key.stuck {
    background: #F44336 !important; /* Red */
    color: white !important;
    animation: stuckPulse 1.5s infinite;
}

/* Animation for stuck keys */
@keyframes stuckPulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Dark mode overrides */
body.dark-theme .key.pressed {
    background: #2E7D32 !important; /* Darker green for dark mode */
    box-shadow: 0 2px 0 #1B5E20, 0 4px 8px rgba(0,0,0,0.4) !important;
}

body.dark-theme .key.tested {
    background: #1B5E20 !important; /* Darker light green for dark mode */
    color: #B9F6CA !important;
}

body.dark-theme .key.stuck {
    background: #C62828 !important; /* Darker red for dark mode */
    box-shadow: 0 2px 0 #7F0000, 0 4px 8px rgba(0,0,0,0.4) !important;
}
@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

@keyframes bounceIn {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.05); }
    70% { transform: translate(-50%, -50%) scale(0.9); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes keyTest {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Responsive Design */
@media (max-width: 1500px) {
    body {
        justify-content: flex-start;
        padding: 10px;
    }
    
    .keyboard {
        width: fit-content;
        max-width: 100%;
        margin: 0 auto;
        padding: 20px 30px;
    }
    
    .keyboard-layout {
        display: flex;
    gap: 15px;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    }
}

@media (max-width: 1200px) {
    .keyboard {
         padding: 10px;
     }
     
     .key {
         height: 35px;
         font-size: 10px;
         min-width: 35px;
     }
}

@media (max-width: 900px) {
  
    
    .key {
        height: 30px;
        font-size: 9px;
        min-width: 30px;
    }
    
    .keyboard-layout {
        gap: 8px;
    }
 }