/* Settings Container - Mirroring Boss Modal */
.settings-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    pointer-events: none;
}

.settings-container.active {
    display: flex;
    pointer-events: auto;
}

/* Settings Panel - Mirroring Boss Modal */
.settings-panel {
    background: #111111;
    border: 1px solid #333;
    border-radius: 8px;
    width: min(700px, 95vw);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    color: #e0e0e0;
    font-family: Arial, sans-serif;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

/* Settings Header - styled like boss-header */
.settings-header {
    background: linear-gradient(180deg, #222 0%, #111 100%);
    border-bottom: 1px solid #444;
    padding: 15px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-header h3 {
    margin: 0;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

/* Settings Body - styled like boss-body for vertical side-by-side tabs and content */
.settings-body {
    display: flex;
    flex-direction: row;
    padding: 15px;
    gap: 15px;
    height: 65vh; /* Fixed height for independent scrolling */
    min-height: 200px;
    max-height: calc(85vh - 60px); /* Fits inside panel */
    overflow: hidden;
    width: 100%;
}

/* Settings Tabs - styled like boss-tabs */
.settings-tabs {
    display: flex;
    flex-direction: column;
    width: 150px;
    min-width: 150px;
    gap: 5px;
    border-right: 1px solid #333;
    padding-right: 15px;
    overflow-y: auto;
}

.settings-tab {
    flex-shrink: 0;
    background: #222;
    border: 1px solid #444;
    color: #ccc;
    padding: 10px;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    font-weight: bold;
    font-size: 13px;
    white-space: nowrap;
}

.settings-tab:hover {
    background: #333;
    color: #fff;
}

.settings-tab.active {
    background: #555;
    color: #ff9900;
    border-color: #777;
}

/* Settings Close Button */
.settings-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-close img {
    width: 20px;
    height: 20px;
}

/* Settings Content Container */
.settings-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    padding-right: 5px;
}

/* Settings Tab Content */
.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.simple-tab-content {
    background: rgba(0, 0, 0, 0.9);
    border-radius: 16px;
    padding: 12px 14px;
    margin-top: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
}

.simple-tab-content .setting-item {
    background: rgba(10, 10, 10, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 10px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.simple-tab-content .setting-label span:not(.setting-icon) {
    color: #f1f1f1;
}

.simple-tab-content .setting-hint {
    color: rgba(255, 255, 255, 0.55) !important;
}

.simple-tab-content .setting-icon {
    background: rgba(255, 255, 255, 0.08);
}

.account-tab-content {
    background: rgba(0, 0, 0, 0.9);
    border-radius: 16px;
    padding: 10px 10px;
    margin-top: 4px;
}

.account-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
}

@media (min-width: 640px) {
    .account-columns {
        grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
        align-items: flex-start;
    }
}

.account-logout-column,
.account-change-password-column {
    padding: 6px 8px;
}

.account-heading {
    font-size: 15px;
    font-weight: 700;
    color: #f1f1f1;
    margin-bottom: 6px;
}

.account-text {
    display: none; /* Ẩn mô tả để tiết kiệm chiều cao */
}

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

/* Settings Section Header */
.settings-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin: 20px 0 12px 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border-left: 4px solid #667eea;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
}

.settings-section-header .section-icon {
    font-size: 20px;
}

/* Setting Item */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    margin-bottom: 12px;
    background: rgba(60, 60, 60, 0.8);
    border-radius: 12px;
    border: 1px solid rgba(100, 100, 100, 0.3);
    transition: all 0.3s ease;
}

.setting-item:hover {
    background: rgba(80, 80, 80, 0.9);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    flex-direction: row;
}

.setting-text-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.setting-hint {
    font-size: 11px !important;
    color: rgba(255, 255, 255, 0.5) !important;
    margin-left: 4px;
}

.setting-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(100, 100, 100, 0.3);
    border-radius: 10px;
}

.setting-label span:not(.setting-icon) {
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
}

.setting-item.logout-setting {
    border-color: rgba(231, 76, 60, 0.4);
    background: rgba(231, 76, 60, 0.12);
    align-items: center;
}

.setting-item.logout-setting .setting-icon {
    background: rgba(231, 76, 60, 0.2);
}

.settings-logout-btn {
    width: 100%;
    max-width: 180px;
    flex-shrink: 0;
}

.change-password-item {
    padding: 4px 0;
}

.change-password-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.change-password-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.change-password-row label {
    font-size: 12px;
    color: #cccccc;
    margin-left: 3px;
    margin-bottom: 2px;
}

.auth-style-input {
    width: 100%;
    height: 34px;
    padding: 6px 10px;
    border: none;
    font-size: 13px;
    transition: all 0.3s ease;
    background: url('../assets/icon/ui/input.webp') no-repeat center;
    background-size: 100% 100%;
    background-color: transparent;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    filter: brightness(0.8);
    opacity: 0.9;
}

.auth-style-input:focus {
    outline: none;
    background: url('../assets/icon/ui/inputhover.webp') no-repeat center;
    background-size: 100% 100%;
    background-color: transparent;
    filter: brightness(1);
    opacity: 1;
}

.auth-style-button {
    width: 100%;
    height: 36px;
    margin-top: 2px;
    padding: 8px 12px;
    background: url('../assets/icon/ui/button.webp') no-repeat center;
    background-size: 100% 100%;
    background-color: transparent;
    color: white;
    border: none;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-shadow: 0 2px 3px rgba(0,0,0,0.7);
    transition: transform 0.1s ease, filter 0.1s ease;
}

.auth-style-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.auth-style-button:active {
    transform: translateY(1px);
    filter: brightness(0.95);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 30px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(100, 100, 100, 0.5);
    transition: all 0.4s ease;
    border-radius: 30px;
    border: 2px solid rgba(150, 150, 150, 0.3);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 2px;
    bottom: 2px;
    background: white;
    transition: all 0.4s ease;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-color: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.toggle-switch:hover .toggle-slider {
    background: rgba(120, 120, 120, 0.6);
}

.toggle-switch input:checked:hover + .toggle-slider {
    background: linear-gradient(135deg, #56bf54 0%, #4fb54a 100%);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .settings-panel {
        width: 88%;
        max-width: 100%;
        max-height: 55vh;
    }
    
    .settings-header {
        padding: 3px 5px;
    }
    
    .settings-header h3 {
        font-size: 14px;
    }
    
    .settings-tab {
        padding: 3px 5px;
        font-size: 10px;
    }
    
    .settings-close {
        font-size: 16px;
        width: 20px;
        height: 20px;
    }
    
    .settings-content {
        padding: 3px;
    }
    
    .setting-item {
        padding: 10px 12px;
        margin-bottom: 8px;
    }
    
    .setting-label {
        gap: 10px;
    }
    
    .setting-label span:not(.setting-icon) {
        font-size: 13px;
    }
    
    .setting-icon {
        font-size: 18px;
        width: 32px;
        height: 32px;
    }
    
    .toggle-switch {
        width: 48px;
        height: 25px;
    }
    
    .toggle-slider:before {
        height: 17px;
        width: 17px;
    }
    
    .toggle-switch input:checked + .toggle-slider:before {
        transform: translateX(23px);
    }
}

@media (max-width: 480px) {
    .settings-panel {
        width: 88%;
        max-width: 100%;
        max-height: 55vh;
    }
    
    .settings-header {
        padding: 3px 5px;
    }
    
    .settings-header h3 {
        font-size: 14px;
    }
    
    .settings-tab {
        padding: 3px 5px;
        font-size: 10px;
    }
    
    .settings-close {
        font-size: 16px;
        width: 20px;
        height: 20px;
    }
    
    .settings-content {
        padding: 3px;
    }
    
    .setting-item {
        padding: 8px 10px;
        margin-bottom: 6px;
    }
    
    .setting-label {
        gap: 8px;
    }
    
    .setting-label span:not(.setting-icon) {
        font-size: 12px;
    }
    
    .setting-icon {
        font-size: 16px;
        width: 28px;
        height: 28px;
    }
    
    .toggle-switch {
        width: 44px;
        height: 23px;
    }
    
    .toggle-slider {
        border: 1.5px solid rgba(150, 150, 150, 0.3);
    }
    
    .toggle-slider:before {
        height: 15px;
        width: 15px;
        left: 2px;
        bottom: 2px;
    }
    
    .toggle-switch input:checked + .toggle-slider:before {
        transform: translateX(21px);
    }
}

/* Slider Container */
.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.slider-container input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 140px;
    height: 6px;
    background: rgba(100, 100, 100, 0.5);
    border-radius: 10px;
    outline: none;
    transition: background 0.3s ease;
}

.slider-container input[type="range"]:hover {
    background: rgba(120, 120, 120, 0.6);
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.5);
    transition: all 0.3s ease;
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 12px rgba(76, 175, 80, 0.7);
}

.slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.5);
    transition: all 0.3s ease;
}

.slider-container input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 12px rgba(76, 175, 80, 0.7);
}


@media (max-width: 768px) {
    .slider-container {
        gap: 8px;
    }
    
    .slider-container input[type="range"] {
        width: 100px;
        height: 5px;
    }
    
    .slider-container input[type="range"]::-webkit-slider-thumb {
        width: 16px;
        height: 16px;
    }
    
    .slider-container input[type="range"]::-moz-range-thumb {
        width: 16px;
        height: 16px;
    }
    
}

@media (max-width: 480px) {
    .slider-container {
        gap: 6px;
    }
    
    .slider-container input[type="range"] {
        width: 80px;
        height: 4px;
    }
    
    .slider-container input[type="range"]::-webkit-slider-thumb {
        width: 14px;
        height: 14px;
    }
    
    .slider-container input[type="range"]::-moz-range-thumb {
        width: 14px;
        height: 14px;
    }
    
}

/* FPS Selector */
.fps-selector {
    padding: 8px 12px;
    background: rgba(40, 40, 40, 0.8);
    border: 1px solid rgba(100, 100, 100, 0.3);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    min-width: 180px;
    flex-shrink: 0;
}

.fps-selector:hover {
    background: rgba(50, 50, 50, 0.9);
    border-color: rgba(52, 152, 219, 0.5);
}

.fps-selector:focus {
    border-color: rgba(52, 152, 219, 0.7);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.fps-selector option {
    background: rgba(30, 30, 30, 0.95);
    color: #fff;
    padding: 8px;
}

@media (max-width: 768px) {
    .fps-selector {
        min-width: 150px;
        font-size: 13px;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    .fps-selector {
        min-width: 120px;
        font-size: 12px;
        padding: 5px 8px;
    }
}

/* PWA Install Button */
.install-game-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.install-game-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.install-game-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
}

.install-game-btn:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

.install-game-item {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    border: 2px solid rgba(102, 126, 234, 0.3);
}

.install-game-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.25), rgba(118, 75, 162, 0.25));
    border-color: rgba(102, 126, 234, 0.5);
}

@media (max-width: 768px) {
    .install-game-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .install-game-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
}

/* Giftcode Tab Styles */
.giftcode-container {
    padding: 20px;
}

.giftcode-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #f1f1f1;
}

.giftcode-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.giftcode-input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.giftcode-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(10, 10, 10, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #f1f1f1;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.giftcode-input:focus {
    border-color: rgba(102, 126, 234, 0.6);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.giftcode-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.giftcode-redeem-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #000000 0%, #000000 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.giftcode-redeem-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.giftcode-redeem-btn:active:not(:disabled) {
    transform: translateY(0);
}

.giftcode-redeem-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.giftcode-message {
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    min-height: 20px;
    transition: all 0.3s ease;
}

.giftcode-message.success {
    background: rgba(46, 204, 113, 0.2);
    border: 1px solid rgba(46, 204, 113, 0.4);
    color: #2ecc71;
}

.giftcode-message.error {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid rgba(231, 76, 60, 0.4);
    color: #e74c3c;
}

.giftcode-message.info {
    background: rgba(52, 152, 219, 0.2);
    border: 1px solid rgba(52, 152, 219, 0.4);
    color: #3498db;
}

@media (max-width: 480px) {
    .giftcode-input-container {
        flex-direction: column;
    }
    
    .giftcode-redeem-btn {
        width: 100%;
    }
}

/* Mobile Landscape Mode - Màn hình xoay ngang (dùng max-height để detect mobile) */
@media (orientation: landscape) and (max-height: 900px) {
    .settings-container {
        align-items: center !important;
        justify-content: center !important;
        overflow-x: auto !important;
    }
    
    .settings-panel {
        width: 90% !important;
        max-width: 900px !important;
        min-width: 500px !important;
        max-height: 85vh !important;
        box-sizing: border-box !important;
        flex-shrink: 0 !important;
    }
    
    .settings-header {
        padding: 6px 12px !important;
        min-width: 0 !important;
    }
    
    .settings-tabs {
        gap: 6px !important;
        flex-wrap: nowrap !important;
    }
    
    .settings-tab {
        padding: 3px 6px !important;
        font-size: 10px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }
}

