/**
 * Trade Troubleshooting Modal Styles
 * @version 1.0.0
 * @author GenPKM.com
 */

/* Modal Overlay */
.troubleshooting-modal {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100vh !important;
    min-height: -webkit-fill-available !important;
    z-index: 999999 !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

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

.troubleshooting-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100vh !important;
    min-height: -webkit-fill-available !important;
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 999998 !important;
}

/* Modal Content */
.troubleshooting-modal-content {
    position: relative !important;
    background: linear-gradient(135deg, rgba(16, 22, 35, 0.98), rgba(13, 17, 23, 0.98)) !important;
    border-radius: 16px;
    max-width: 800px;
    max-height: 85vh;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6),
                0 0 40px rgba(255, 60, 60, 0.2);
    border: 2px solid rgba(255, 60, 60, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    z-index: 999999 !important;
    margin: auto;
}

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

/* Modal Header */
.troubleshooting-modal-header {
    background: linear-gradient(135deg, rgba(255, 60, 60, 0.2), rgba(255, 120, 40, 0.2));
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid rgba(255, 60, 60, 0.3);
}

.troubleshooting-modal-header h2 {
    margin: 0;
    color: #ffffff;
    font-size: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.troubleshooting-modal-header h2 i {
    color: #ffcc00;
    font-size: 28px;
}

.troubleshooting-modal-close {
    background: transparent;
    border: none;
    color: #9fafca;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.troubleshooting-modal-close:hover {
    background: rgba(255, 60, 60, 0.2);
    color: #ff3c3c;
    transform: rotate(90deg);
}

/* Modal Body */
.troubleshooting-modal-body {
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Custom scrollbar */
.troubleshooting-modal-body::-webkit-scrollbar {
    width: 10px;
}

.troubleshooting-modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
}

.troubleshooting-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 60, 60, 0.5);
    border-radius: 5px;
}

.troubleshooting-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 60, 60, 0.7);
}

/* Error Explanation */
.troubleshooting-error-explanation {
    background: rgba(255, 60, 60, 0.1);
    border-left: 4px solid #ff3c3c;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.troubleshooting-error-explanation p {
    margin: 0 0 8px 0;
    color: #ffffff;
    line-height: 1.6;
}

.troubleshooting-error-explanation p:last-child {
    margin-bottom: 0;
}

.troubleshooting-error-explanation strong {
    color: #ff7828;
}

/* Game Sections */
.troubleshooting-game-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 60, 60, 0.2);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.game-section:hover {
    border-color: rgba(255, 60, 60, 0.4);
    box-shadow: 0 4px 16px rgba(255, 60, 60, 0.1);
}

.game-section h3 {
    margin: 0 0 16px 0;
    color: #ff7828;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(255, 120, 40, 0.3);
}

.game-section h3 i {
    color: #ff3c3c;
}

.game-instructions h4 {
    margin: 16px 0 12px 0;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
}

.game-instructions ol,
.game-instructions ul {
    margin: 0;
    padding-left: 24px;
    color: #9fafca;
    line-height: 1.8;
}

.game-instructions li {
    margin-bottom: 8px;
}

.game-instructions li:last-child {
    margin-bottom: 0;
}

.game-instructions strong {
    color: #ffffff;
    font-weight: 600;
}

/* Keyboard key styling */
kbd {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, rgba(255, 60, 60, 0.3), rgba(255, 120, 40, 0.3));
    border: 1px solid rgba(255, 60, 60, 0.5);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* General Tips Section */
.game-section.general-tips {
    background: rgba(76, 217, 100, 0.05);
    border-color: rgba(76, 217, 100, 0.3);
}

.game-section.general-tips:hover {
    border-color: rgba(76, 217, 100, 0.5);
}

.game-section.general-tips h3 {
    color: #4cd964;
    border-bottom-color: rgba(76, 217, 100, 0.3);
}

.game-section.general-tips h3 i {
    color: #ffcc00;
}

/* Modal Footer */
.troubleshooting-modal-footer {
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 2px solid rgba(255, 60, 60, 0.3);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.troubleshooting-modal-footer .btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    white-space: nowrap;
    width: 100%;
}

.troubleshooting-modal-footer .btn-primary {
    background: linear-gradient(135deg, #ff3c3c, #ff7828);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(255, 60, 60, 0.3);
}

.troubleshooting-modal-footer .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 60, 60, 0.4);
}

.troubleshooting-modal-footer .btn-primary:active {
    transform: translateY(0);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .troubleshooting-modal {
        padding: 0;
        align-items: flex-start;
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .troubleshooting-modal-content {
        max-height: 95vh;
        max-height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0));
        border-radius: 0;
        margin: 0;
        width: 100%;
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    .troubleshooting-modal-header {
        padding: 16px 20px;
        position: sticky;
        top: 0;
        z-index: 10;
        background: linear-gradient(135deg, rgba(255, 60, 60, 0.25), rgba(255, 120, 40, 0.25));
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .troubleshooting-modal-header h2 {
        font-size: 18px;
    }

    .troubleshooting-modal-body {
        padding: 16px;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .game-section {
        padding: 16px;
    }

    .game-section h3 {
        font-size: 16px;
    }

    .game-instructions h4 {
        font-size: 15px;
    }

    .game-instructions ol,
    .game-instructions ul {
        padding-left: 20px;
        font-size: 14px;
    }

    .troubleshooting-modal-footer {
        padding: 16px;
        position: sticky;
        bottom: 0;
        z-index: 10;
        background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .troubleshooting-modal-footer .btn {
        width: 100%;
        padding: 14px 24px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .troubleshooting-modal-header h2 {
        font-size: 16px;
        gap: 8px;
    }

    .troubleshooting-modal-header h2 i {
        font-size: 20px;
    }

    .game-section h3 {
        font-size: 15px;
    }

    .game-instructions h4 {
        font-size: 14px;
    }

    .game-instructions ol,
    .game-instructions ul {
        font-size: 13px;
        line-height: 1.6;
    }

    .troubleshooting-modal-body {
        padding: 12px;
    }

    .troubleshooting-modal-footer {
        padding: 12px;
    }

    .troubleshooting-modal-footer .btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (max-height: 500px) and (orientation: landscape) {
    .troubleshooting-modal-content {
        max-height: 100vh;
        border-radius: 0;
    }

    .troubleshooting-modal-header {
        padding: 12px 16px;
    }

    .troubleshooting-modal-body {
        padding: 12px 16px;
    }

    .troubleshooting-modal-footer {
        padding: 12px 16px;
    }

    .game-section {
        padding: 12px;
    }
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}
