/**
 * Modal ablakok: RAL színválasztó és motor segítő
 * Konszolidált fájl: ral-modal + motor-helper-modal
 */

/* ================================================================ */
/* 1. RAL SZÍNVÁLASZTÓ MODAL */
/* ================================================================ */

/* RAL Modal Alap Struktúra */
.config-ral-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    box-sizing: border-box;
}

.config-ral-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
}

.config-ral-modal-content {
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: 95vh;
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
}

/* RAL Modal Header */
.config-ral-modal-header {
    padding: var(--spacing-lg) 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-light);
}

.config-ral-modal-header h3 {
    margin: 0;
    color: var(--text-dark, #333);
    font-size: 18px;
    font-weight: 600;
}

.config-ral-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary, #666);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-md, 8px);
    transition: all var(--transition, 0.2s ease);
}

.config-ral-modal-close:hover {
    background: var(--border-color, #e0e0e0);
    color: var(--text-dark, #333);
}

/* RAL Modal Body */
.config-ral-modal-body {
    padding: var(--spacing-lg) 25px;
    overflow-y: auto;
    flex: 1;
}

.config-ral-search-wrapper {
    margin-bottom: var(--spacing-lg);
}

.config-ral-search-input {
    width: 100%;
    height: var(--input-height, 48px);
    padding: var(--spacing-md) var(--spacing-lg);
    border: 2px solid var(--border-color, #ddd);
    border-radius: var(--border-radius-lg, 12px);
    font-size: var(--font-size-base, 16px);
    transition: border-color var(--transition, 0.2s ease);
    background: var(--bg-white, white);
}

.config-ral-search-input:focus {
    outline: none;
    border-color: var(--primary-color, #3498db);
    box-shadow: 0 0 0 0.2rem rgba(44, 62, 80, 0.25);
}

/* RAL Color Grid */
.config-ral-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--spacing-md);
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: var(--border-radius-lg, 12px);
    background: var(--bg-light, #f8f9fa);
}

.config-ral-modal-color {
    width: 120px;
    height: 80px;
    border-radius: var(--border-radius-lg, 12px);
    border: 2px solid var(--border-color, #ddd);
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: var(--spacing-sm, 8px);
    transition: all var(--transition, 0.2s ease);
    position: relative;
    box-shadow: var(--shadow-sm);
}

.config-ral-modal-color:hover {
    border-color: var(--primary-color, #3498db);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.config-ral-modal-color:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.config-ral-modal-color.hidden {
    display: none;
}

/* RAL Color Info */
.config-ral-modal-info {
    background: rgba(255, 255, 255, 0.95);
    padding: 4px var(--spacing-sm, 8px);
    border-radius: var(--border-radius, 6px);
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(2px);
    width: 100%;
}

.config-ral-modal-code {
    display: block;
    font-size: var(--font-size-sm, 14px);
    font-weight: 700;
    color: #333;
    line-height: 1.2;
}

.config-ral-modal-name {
    display: block;
    font-size: 9px;
    color: #666;
    line-height: 1.1;
    margin-top: 1px;
    font-weight: 500;
}

/* No Results Message */
.config-ral-no-results {
    background: var(--bg-white, white);
    border: 2px dashed var(--border-color, #ddd);
    border-radius: var(--border-radius-lg, 12px);
    color: var(--text-secondary, #666);
    font-size: var(--font-size-base, 16px);
    line-height: 1.5;
    transition: all 0.3s ease;
    padding: 30px 20px;
    text-align: center;
    font-style: italic;
}

/* RAL Modal Animations */
.config-ral-modal {
    animation: ralModalFadeIn 0.3s ease-out;
}

.config-ral-modal-content {
    animation: ralModalSlideIn 0.3s ease-out;
}

@keyframes ralModalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes ralModalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}


/* ================================================================ */
/* 2. MOTOR SEGÍTŐ MODAL */
/* ================================================================ */

.config-motor-helper-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    box-sizing: border-box;
}

.config-motor-helper-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
}

.config-motor-helper-content {
    position: relative;
    width: 90%;
    max-width: 1400px;
    height: 85vh;
    min-height: 600px;
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
}

.config-motor-helper-header {
    padding: var(--spacing-lg) 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-light);
}

.config-motor-helper-header h3 {
    margin: 0;
    color: var(--text-dark, #333);
    font-size: 18px;
    font-weight: 600;
}

.config-motor-helper-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary, #666);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-md, 8px);
    transition: all var(--transition, 0.2s ease);
}

.config-motor-helper-close:hover {
    background: var(--border-color, #e0e0e0);
    color: var(--text-dark, #333);
}

.config-motor-helper-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
    position: relative;
    display: flex;
    align-items: stretch;
}

.config-motor-helper-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex !important;
    flex-direction: column;
    align-items: center !important;
    justify-content: center !important;
    background: var(--bg-white, white);
    z-index: 2;
    text-align: center;
}

/* Biztosítjuk hogy a loading mindig látható amikor kell */
.config-motor-helper-loading[style*="display: flex"] {
    display: flex !important;
}

.config-motor-helper-loading p {
    margin: 15px 0 0 0 !important;
    padding: 0 !important;
    color: var(--text-secondary, #666);
    font-size: var(--font-size-base, 16px);
    text-align: center !important;
    width: 100%;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color, #f3f3f3);
    border-top: 4px solid var(--primary-color, #3498db);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto !important;
    display: block !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#motorHelperIframe {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--bg-white, white);
}

/* Motor Helper Modal Animations */
.config-motor-helper-modal {
    animation: modalFadeIn 0.3s ease-out;
}

.config-motor-helper-content {
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}


/* ================================================================ */
/* 3. MODAL RESPONSIVE DESIGN */
/* ================================================================ */

/* RAL Modal Responsive */
@media (max-width: 768px) {
    .config-ral-modal {
        padding: 10px;
    }
    
    .config-ral-modal-content {
        width: 95%;
        max-height: 80vh;
        border-radius: 8px;
    }
    
    .config-ral-modal-header {
        padding: 15px;
    }
    
    .config-ral-modal-header h3 {
        font-size: 16px;
    }
    
    .config-ral-modal-body {
        padding: 15px;
    }
    
    .config-ral-modal-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .config-ral-modal-color {
        width: 100px;
        height: 70px;
    }
}

@media (max-width: 480px) {
    .config-ral-modal {
        padding: 5px;
    }
    
    .config-ral-modal-content {
        width: 100%;
        max-height: 85vh;
        border-radius: 0;
    }
    
    .config-ral-modal-header {
        padding: 12px;
    }
    
    .config-ral-modal-header h3 {
        font-size: 14px;
    }
    
    .config-ral-modal-body {
        padding: 12px;
    }
    
    .config-ral-modal-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 8px;
    }
    
    .config-ral-modal-color {
        width: 90px;
        height: 60px;
    }
}

/* Motor Helper Modal Responsive */
@media (max-width: 768px) {
    .config-motor-helper-modal {
        padding: 10px;
    }
    
    .config-motor-helper-content {
        width: 95%;
        height: 80vh;
        min-height: 400px;
        border-radius: 8px;
    }
    
    .config-motor-helper-header {
        padding: 15px;
    }
    
    .config-motor-helper-header h3 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .config-motor-helper-modal {
        padding: 5px;
    }
    
    .config-motor-helper-content {
        width: 100%;
        height: 85vh;
        min-height: 350px;
        border-radius: 0;
    }
    
    .config-motor-helper-header {
        padding: 12px;
    }
    
    .config-motor-helper-header h3 {
        font-size: 14px;
    }
}


/* ================================================================ */
/* 4. SECTION INFO MODAL */
/* ================================================================ */

/* Section Info Ikon a címekben */
.config-section__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.config-section-info-icon {
    cursor: pointer;
    color: var(--bg-white, white);
    font-size: 25px;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 10px;
}

.config-section-info-icon i {
    pointer-events: none;
}

/* Section Info Modal Alap Struktúra */
.config-section-info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    box-sizing: border-box;
}

.config-section-info-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
}

.config-section-info-content {
    position: relative;
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
}

/* Section Info Modal Header */
.config-section-info-header {
    padding: var(--spacing-lg) 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-light);
}

.config-section-info-header h3 {
    margin: 0;
    color: var(--text-dark, #333);
    font-size: 18px;
    font-weight: 600;
}

.config-section-info-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary, #666);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-md, 8px);
    transition: all var(--transition, 0.2s ease);
}

.config-section-info-close:hover {
    background: var(--border-color, #e0e0e0);
    color: var(--text-dark, #333);
}

/* Section Info Modal Body */
.config-section-info-body {
    padding: var(--spacing-lg) 25px;
    overflow-y: auto;
    flex: 1;
}

/* Section Info Tartalom Stílusok */
.section-info-content h4 {
    color: var(--primary-color, #3498db);
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
}

.section-info-content h4:not(:first-child) {
    margin-top: 20px;
}

.section-info-content ul {
    margin: 0 0 15px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.section-info-content ul li {
    margin-bottom: 8px;
    line-height: 1.6;
    color: var(--text-dark, #333);
}

.section-info-content ul li strong {
    color: var(--primary-color, #3498db);
    font-weight: 600;
}

.section-info-content p {
    margin: 0 0 12px 0;
    line-height: 1.6;
    color: var(--text-dark, #333);
}

.info-tip {
    background: #e7f3ff;
    border-left: 4px solid var(--primary-color, #3498db);
    padding: 12px 15px;
    margin-top: 20px;
    border-radius: 4px;
}

.info-tip strong {
    color: var(--primary-color, #3498db);
    display: block;
    margin-bottom: 5px;
}

.info-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px 15px;
    margin-top: 20px;
    border-radius: 4px;
}

.info-warning strong {
    color: #856404;
    display: block;
    margin-bottom: 5px;
}

/* Info képek grid */
.info-images-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 15px 0 20px 0;
}

.info-image-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.info-image-item img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

.info-image-caption {
    text-align: center;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-dark, #333);
    margin: 0;
}

.info-image-caption strong {
    color: var(--primary-color, #3498db);
    display: block;
    margin-bottom: 3px;
}

/* Info képek grid - Responsive */
@media (max-width: 768px) {
    .info-images-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .info-images-grid {
        gap: 12px;
    }
    
    .info-image-caption {
        font-size: 13px;
    }
}

/* Section Info Modal Animations */
.config-section-info-modal {
    animation: sectionInfoFadeIn 0.3s ease-out;
}

.config-section-info-content {
    animation: sectionInfoSlideIn 0.3s ease-out;
}

@keyframes sectionInfoFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes sectionInfoSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Section Info Modal Responsive */
@media (max-width: 768px) {
    .config-section-info-modal {
        padding: 10px;
    }
    
    .config-section-info-content {
        width: 95%;
        max-height: 80vh;
        border-radius: 8px;
    }
    
    .config-section-info-header {
        padding: 15px;
    }
    
    .config-section-info-header h3 {
        font-size: 16px;
    }
    
    .config-section-info-body {
        padding: 15px;
    }
    
    .config-section-info-icon {
        font-size: 25px;
    }
}

@media (max-width: 480px) {
    .config-section-info-modal {
        padding: 5px;
    }
    
    .config-section-info-content {
        width: 100%;
        max-height: 85vh;
        border-radius: 0;
    }
    
    .config-section-info-header {
        padding: 12px;
    }
    
    .config-section-info-header h3 {
        font-size: 14px;
    }
    
    .config-section-info-body {
        padding: 12px;
    }
    
    .section-info-content h4 {
        font-size: 14px;
    }
    
    .section-info-content ul li {
        font-size: 14px;
    }
    
    .config-section-info-icon {
        font-size: 25px;
    }
    
    /* Képek egymás alá mobilon */
    .info-images-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .info-image-caption {
        font-size: 13px;
    }
}


/* ================================================================ */
/* 5. BODY SCROLL LETILTÁS MODAL NYITÁSAKOR */
/* ================================================================ */

body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100vh;
    top: 0;
    left: 0;
}