/* ============================================
   MODALS CSS - Модальные окна
   ============================================ */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    padding: 20px;
}

.modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: linear-gradient(135deg, var(--bg-panel) 0%, var(--bg-dark) 100%);
    border: 2px solid var(--accent);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 70vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.modal-content::-webkit-scrollbar { width: 8px; }
.modal-content::-webkit-scrollbar-track { background: var(--bg-dark); border-radius: 4px; }
.modal-content::-webkit-scrollbar-thumb { 
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%); 
    border-radius: 4px; 
}

.modal.visible .modal-content {
    transform: scale(1);
}

.modal-content.modal-small {
    max-width: 360px;
    text-align: center;
}

.modal-body {
    padding: 16px 0;
}

.modal-body p {
    font-size: 16px;
    color: var(--text);
    margin: 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header h3 .icon {
    font-size: 24px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-card);
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-content input[type="text"] {
    width: 100%;
    padding: 12px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 16px;
}

.modal-content input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ============================================
   SETTINGS MODAL
   ============================================ */

.settings-section {
    margin-bottom: 20px;
}

.settings-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    font-size: 13px;
    font-weight: 600;
}

.setting-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-value {
    min-width: 40px;
    text-align: right;
    font-size: 12px;
    color: var(--accent);
    font-weight: 700;
}
input[type="range"] {
    -webkit-appearance: none;
    width: 120px;
    height: 6px;
    background: var(--bg-card);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
.checkbox-wrapper {
    position: relative;
    width: 44px;
    height: 24px;
}

.checkbox-wrapper input {
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-card);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.checkbox-slider:before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.3s;
}

.checkbox-wrapper input:checked + .checkbox-slider {
    background: var(--accent);
}

.checkbox-wrapper input:checked + .checkbox-slider:before {
    transform: translateX(20px);
    background: white;
}

.settings-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}

/* ============================================
   SHOP MODAL
   ============================================ */

.shop-info {
    text-align: center;
    padding: 10px;
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 16px;
}

.shop-grid-info {
    font-size: 12px;
    color: var(--text-secondary);
}

.shop-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 8px;
}

.shop-items::-webkit-scrollbar { width: 8px; }
.shop-items::-webkit-scrollbar-track { background: var(--bg-dark); border-radius: 4px; }
.shop-items::-webkit-scrollbar-thumb { 
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%); 
    border-radius: 4px; 
}

.shop-category-title {
    grid-column: 1 / -1;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    margin: 16px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.shop-category-title:first-child {
    margin-top: 0;
}

.shop-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 10px;
    transition: all 0.2s;
    text-align: center;
}

.shop-item:hover:not(.disabled) {
    border-color: var(--accent);
}

.shop-item.disabled {
    opacity: 0.5;
}

.shop-item.purchased {
    border-color: var(--success);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(34, 197, 94, 0.1) 100%);
}

.shop-item-icon {
    font-size: 28px;
}

.shop-item-info {
    flex: 1;
}

.shop-item-name {
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 2px;
}

.shop-item-desc {
    font-size: 10px;
    color: var(--text-secondary);
}

.shop-item-status {
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 4px;
}

.shop-item-buy {
    width: 100%;
}

.shop-item-price {
    font-weight: 700;
    font-size: 13px;
    color: var(--accent);
    margin-bottom: 6px;
}

.shop-item-price.shop-item-free {
    color: var(--success);
}

.shop-item-ad {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(34, 197, 94, 0.1) 100%);
    border-color: var(--success);
}

.shop-item-ad .shop-item-icon {
    font-size: 32px;
}

.shop-item-ad .shop-item-info {
    text-align: left;
    flex: 1;
    margin-left: 12px;
}

.shop-item-ad .shop-item-buy {
    width: auto;
    text-align: right;
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%);
    color: white;
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #16a34a 0%, var(--success) 100%);
    transform: scale(1.05);
}

/* ============================================
   ACHIEVEMENTS MODAL
   ============================================ */

.achievements-progress {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 8px;
}

.achievements-progress-bar {
    height: 8px;
    background: var(--bg-hover);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.achievements-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--success) 100%);
    border-radius: 4px;
    transition: width 0.5s;
}

.achievements-progress-text {
    font-size: 12px;
    text-align: center;
    color: var(--text-secondary);
}

.achievements-list {
    max-height: 350px;
    overflow-y: auto;
    padding-right: 8px;
}

.achievements-list::-webkit-scrollbar { width: 8px; }
.achievements-list::-webkit-scrollbar-track { background: var(--bg-dark); border-radius: 4px; }
.achievements-list::-webkit-scrollbar-thumb { 
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%); 
    border-radius: 4px; 
}

.achievement-group {
    margin-bottom: 16px;
}

.achievement-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-left: 4px;
}

.achievement-group-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.achievement-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
    text-align: center;
}

.achievement-item.unlocked {
    border-color: var(--success);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(34, 197, 94, 0.1) 100%);
}

.achievement-item.locked {
    opacity: 0.6;
}

.achievement-item-icon {
    font-size: 28px;
}

.achievement-item-info {
    flex: 1;
}

.achievement-item-name {
    font-weight: 700;
    font-size: 11px;
}

.achievement-item-desc {
    font-size: 9px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.achievement-item-reward {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    margin-top: 4px;
}

.achievement-item.unlocked .achievement-item-reward {
    color: var(--success);
}

/* ============================================
   RESPONSIVE MODALS
   ============================================ */
@media (max-width: 900px) {
    .modal-content {
        width: 95%;
        max-width: none;
        padding: 16px;
        border-radius: 12px;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .modal-header h3 .icon {
        font-size: 20px;
    }
    
    .settings-section {
        padding: 12px 0;
    }
    
    .setting-row {
        padding: 8px 0;
    }
    
    .setting-label {
        font-size: 13px;
    }
    
    .shop-items {
        grid-template-columns: 1fr;
    }
    
    .shop-item {
        padding: 12px;
    }
    
    .achievement-group-items {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        width: 100%;
        padding: 14px;
        max-height: 80vh;
    }
    
    .modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .modal-close {
        width: 28px;
        height: 28px;
        font-size: 16px;
        position: absolute;
        top: 8px;
        right: 8px;
    }
    
    .modal-header h3 {
        font-size: 14px;
        width: calc(100% - 40px);
    }
    
    .settings-section-title {
        font-size: 11px;
        padding: 8px 0;
        margin: 4px 0;
    }
    
    .setting-label {
        font-size: 12px;
    }
    
    input[type="range"],
    input[type="text"] {
        font-size: 14px !important;
        padding: 6px !important;
    }
    
    .shop-items {
        gap: 8px;
    }
    
    .achievement-group-items {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .achievement-item {
        padding: 8px 4px;
        gap: 4px;
    }
    
    .achievement-item-icon {
        font-size: 24px;
    }
    
    .achievement-item-name {
        font-size: 10px;
    }
    
    .achievement-item-desc {
        font-size: 8px;
    }
    
    .achievement-item-reward {
        font-size: 9px;
    }
    
    .achievement-group-title {
        font-size: 10px;
    }
}

@media (max-width: 400px) {
    .modal-content {
        padding: 12px;
    }
    
    .modal-header h3 {
        font-size: 12px;
    }
    
    .achievement-group-items {
        grid-template-columns: 1fr;
    }
    
    .setting-label {
        font-size: 11px;
    }
}
