/* Buttons Grid */
.buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding: 15px;
}

.button-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.1s ease;
}

[data-bs-theme="dark"] .button-item {
    background: #212529;
    border-color: #495057;
}

.button-visual {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(145deg, #e0e0e0, #ffffff);
    border: 2px solid #ccc;
    transition: all 0.1s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .button-visual {
    background: linear-gradient(145deg, #2d3136, #383e45);
    border-color: #495057;
}

.button-visual.pressed {
    background: linear-gradient(145deg, #052c65, #0d6efd);
    border-color: #052c65;
    transform: scale(0.95);
    box-shadow: inset 0 4px 6px rgba(0, 0, 0, 0.3);
}

.button-value {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: bold;
    color: #052c65;
}

[data-bs-theme="dark"] .button-value {
    color: #4dabf7;
}

/* Analog Sticks */
.analog-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.analog-stick {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(145deg, #e0e0e0, #f5f5f5);
    border: 3px solid #adb5bd;
    position: relative;
    margin: 0 auto;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .analog-stick {
    background: linear-gradient(145deg, #1a1d20, #2d3136);
    border-color: #495057;
}

/* Center crosshair */
.analog-stick::before {
    content: '+';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #adb5bd;
    opacity: 0.3;
}

.analog-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(145deg, #6c757d, #495057);
    border: 2px solid #343a40;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: background 0.1s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.analog-dot.active {
    background: linear-gradient(145deg, #052c65, #0d6efd);
    border-color: #052c65;
    box-shadow: 0 0 15px rgba(5, 44, 101, 0.6);
}

.analog-values {
    margin-top: 10px;
    font-family: 'Courier New', monospace;
    color: #052c65;
}

[data-bs-theme="dark"] .analog-values {
    color: #4dabf7;
}

/* Triggers */
.progress {
    height: 30px;
    background-color: #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

[data-bs-theme="dark"] .progress {
    background-color: #343a40;
}

.progress-bar {
    transition: width 0.1s ease;
}

/* D-Pad */
.dpad-container {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.dpad {
    width: 150px;
    height: 150px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 2px;
}

.dpad-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #e0e0e0, #f5f5f5);
    border: 2px solid #adb5bd;
    font-size: 24px;
    font-weight: bold;
    color: #6c757d;
    cursor: default;
    transition: all 0.1s ease;
    user-select: none;
}

[data-bs-theme="dark"] .dpad-btn {
    background: linear-gradient(145deg, #2d3136, #383e45);
    border-color: #495057;
    color: #adb5bd;
}

.dpad-up {
    grid-column: 2;
    grid-row: 1;
    border-radius: 8px 8px 0 0;
}

.dpad-left {
    grid-column: 1;
    grid-row: 2;
    border-radius: 8px 0 0 8px;
}

.dpad-center {
    grid-column: 2;
    grid-row: 2;
    background: #dee2e6;
    border: 1px solid #adb5bd;
}

[data-bs-theme="dark"] .dpad-center {
    background: #1a1d20;
}

.dpad-right {
    grid-column: 3;
    grid-row: 2;
    border-radius: 0 8px 8px 0;
}

.dpad-down {
    grid-column: 2;
    grid-row: 3;
    border-radius: 0 0 8px 8px;
}

.dpad-btn.active {
    background: linear-gradient(145deg, #052c65, #0d6efd);
    color: white;
    transform: scale(0.95);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Gamepad Preview/Mockup */
.gamepad-mockup {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    padding: 40px 20px;
    background: linear-gradient(145deg, #f5f5f5, #e9ecef);
    border-radius: 20px;
    box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .gamepad-mockup {
    background: linear-gradient(145deg, #1a1d20, #212529);
}

.gamepad-left,
.gamepad-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

/* Shoulder buttons */
.shoulder-btn,
.trigger-btn {
    padding: 8px 20px;
    background: linear-gradient(145deg, #6c757d, #495057);
    border: 2px solid #343a40;
    border-radius: 8px;
    color: white;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.trigger-btn {
    background: linear-gradient(145deg, #adb5bd, #6c757d);
}

/* Face buttons (ABXY) */
.face-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 5px;
    width: 100px;
    height: 100px;
}

.face-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    border: 2px solid #343a40;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.face-btn.y {
    grid-column: 2;
    grid-row: 1;
    background: linear-gradient(145deg, #ffc107, #ff9800);
    color: white;
}

.face-btn.x {
    grid-column: 1;
    grid-row: 2;
    background: linear-gradient(145deg, #2196f3, #1976d2);
    color: white;
}

.face-btn.b {
    grid-column: 3;
    grid-row: 2;
    background: linear-gradient(145deg, #f44336, #d32f2f);
    color: white;
}

.face-btn.a {
    grid-column: 2;
    grid-row: 3;
    background: linear-gradient(145deg, #4caf50, #388e3c);
    color: white;
}

/* Analog preview */
.analog-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(145deg, #dee2e6, #ced4da);
    border: 3px solid #6c757d;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .analog-preview {
    background: linear-gradient(145deg, #343a40, #495057);
}

.analog-preview-dot {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: linear-gradient(145deg, #495057, #343a40);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid #212529;
}

/* D-Pad preview */
.dpad-preview {
    width: 100px;
    height: 100px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 2px;
}

.dpad-preview-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #6c757d, #495057);
    border: 2px solid #343a40;
    font-size: 18px;
    color: white;
}

.dpad-preview-btn.up {
    grid-column: 2;
    grid-row: 1;
    border-radius: 6px 6px 0 0;
}

.dpad-preview-btn.left {
    grid-column: 1;
    grid-row: 2;
    border-radius: 6px 0 0 6px;
}

.dpad-preview-center {
    grid-column: 2;
    grid-row: 2;
    background: #495057;
}

.dpad-preview-btn.right {
    grid-column: 3;
    grid-row: 2;
    border-radius: 0 6px 6px 0;
}

.dpad-preview-btn.down {
    grid-column: 2;
    grid-row: 3;
    border-radius: 0 0 6px 6px;
}

/* Center buttons */
.gamepad-center {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.center-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.center-btn {
    padding: 6px 12px;
    background: linear-gradient(145deg, #dee2e6, #ced4da);
    border: 2px solid #adb5bd;
    border-radius: 6px;
    font-size: 10px;
    font-weight: bold;
    color: #495057;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .center-btn {
    background: linear-gradient(145deg, #495057, #343a40);
    color: #adb5bd;
}

.home-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(145deg, #343a40, #212529);
    border: 2px solid #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #adb5bd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .buttons-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
        padding: 10px;
    }

    .button-visual {
        width: 50px;
        height: 50px;
    }

    .analog-stick {
        width: 150px;
        height: 150px;
    }

    .analog-dot {
        width: 30px;
        height: 30px;
    }

    .dpad {
        width: 120px;
        height: 120px;
    }

    .dpad-btn {
        font-size: 18px;
    }

    /* Gamepad mockup responsive */
    .gamepad-mockup {
        flex-direction: column;
        gap: 20px;
        padding: 20px 10px;
    }

    .analog-preview {
        width: 60px;
        height: 60px;
    }

    .analog-preview-dot {
        width: 20px;
        height: 20px;
    }

    .dpad-preview {
        width: 80px;
        height: 80px;
    }

    .face-buttons {
        width: 80px;
        height: 80px;
    }

    .face-btn {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
}
