/* 
 * PRODUCTAI UNIVERSAL MODULE DESIGN SYSTEM
 * Ensures complete UI consistency across all modules
 * Mobile-first responsive design for iPhone/Android compatibility
 * Standardized interactions and visual feedback
 */

/* === UNIVERSAL MODULE CONTAINER === */
.universal-module {
    margin: 15px 0;
    padding: 15px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    position: relative;
}

.universal-module:hover {
    border-color: #007bff;
    box-shadow: 0 2px 6px rgba(0,123,255,0.15);
}

/* === MODULE HEADER === */
.module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.module-title {
    margin: 0;
    color: #495057;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.module-badge {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.toggle-button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.toggle-button:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.toggle-button.collapsed {
    background: #007bff;
}

/* === QUICK SELECTION SYSTEM === */
.quick-selection {
    margin-bottom: 15px;
    padding: 12px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f8ff 100%);
    border: 1px solid #bbdefb;
    border-radius: 6px;
}

.quick-selection-title {
    font-size: 12px;
    color: #1565c0;
    margin-bottom: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.quick-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.quick-button {
    padding: 6px 12px;
    border: 1px solid #90caf9;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    color: #1976d2;
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
}

.quick-button:hover {
    background: #e3f2fd;
    border-color: #42a5f5;
    transform: translateY(-1px);
}

.quick-button.selected {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    border-color: #1976d2;
    font-weight: 600;
    transform: scale(1.02);
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.3);
}

/* === EXPANDABLE SECTIONS === */
.module-section {
    margin-bottom: 15px;
}

.section-toggle {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.section-toggle:hover {
    background: #e9ecef;
    border-color: #007bff;
}

.section-toggle.active {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1565c0;
}

.section-content {
    padding: 12px;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 6px 6px;
    background: white;
    display: none;
    overflow: hidden;
}

.section-content.expanded {
    display: block;
}

.toggle-icon {
    transition: transform 0.2s ease;
    color: #6c757d;
}

.section-toggle.active .toggle-icon {
    transform: rotate(180deg);
    color: #1565c0;
}

/* === UNIVERSAL RADIO BUTTON GRID === */
.radio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

@media (max-width: 576px) {
    .radio-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .radio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 7px;
    }
}

/* === UNIVERSAL RADIO OPTION === */
.radio-option {
    display: flex;
    align-items: flex-start;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 60px;
    position: relative;
}

.radio-option:hover {
    border-color: #007bff;
    background: #f0f8ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,123,255,0.1);
}

.radio-option.selected {
    border-color: #007bff;
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f8ff 100%);
    transform: scale(1.02);
    box-shadow: 0 3px 6px rgba(0,123,255,0.2);
}

.radio-option input[type="radio"] {
    margin: 2px 8px 0 0;
    transform: scale(1.1);
    accent-color: #007bff;
    cursor: pointer;
    /* ✅ Ensure native radio dot is visible across browsers/themes */
    -webkit-appearance: auto;
    appearance: auto;
    background: initial;
}

/* ✅ Custom radio fallback dot for environments where native dot is hidden */
.radio-option {
    position: relative;
}
.radio-option .custom-radio {
    position: relative;
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #c8d6e5;
    border-radius: 50%;
    margin: 0 6px 0 0;
    vertical-align: middle;
}
.radio-option.selected .custom-radio {
    border-color: #007bff;
    background: radial-gradient(circle at center, #007bff 60%, transparent 61%);
}

/* ✅ Force visible checked state even inside highlighted cards */
.radio-option input[type="radio"]:checked {
    accent-color: #007bff;
    outline: none;
}

.radio-option-content {
    flex: 1;
    min-width: 0;
}

.radio-option-title {
    font-weight: 600;
    color: #333;
    font-size: 12px;
    line-height: 1.2;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.radio-option.selected .radio-option-title {
    color: #0056b3;
}

.radio-option-description {
    font-size: 10px;
    color: #666;
    line-height: 1.3;
}

.radio-option.selected .radio-option-description {
    color: #0d47a1;
}

/* === UNIVERSAL PREVIEW SECTION === */
.module-preview {
    padding: 10px;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border: 1px solid #c8e6c9;
    border-radius: 6px;
    margin-top: 12px;
    transition: all 0.2s ease;
}

.preview-title {
    font-size: 11px;
    color: #2e7d32;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.preview-content {
    font-size: 12px;
    color: #1b5e20;
    line-height: 1.3;
}

/* === MOBILE OPTIMIZATIONS === */
@media (max-width: 576px) {
    .universal-module {
        margin: 10px 0;
        padding: 12px;
    }
    
    .module-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .module-title {
        font-size: 14px;
    }
    
    .module-badge {
        font-size: 9px;
        padding: 1px 6px;
    }
    
    .quick-selection {
        padding: 10px;
    }
    
    .quick-buttons {
        justify-content: flex-start;
    }
    
    .quick-button {
        padding: 5px 10px;
        font-size: 10px;
    }
    
    .radio-option {
        padding: 8px;
        min-height: 50px;
    }
    
    .radio-option-title {
        font-size: 11px;
    }
    
    .radio-option-description {
        font-size: 9px;
    }
    
    .section-toggle {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .module-preview {
        padding: 8px;
    }
    
    .preview-title {
        font-size: 10px;
    }
    
    .preview-content {
        font-size: 11px;
    }
}

/* === ACCESSIBILITY === */
.radio-option:focus-within {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.quick-button:focus,
.section-toggle:focus,
.toggle-button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* === ANIMATION UTILITIES === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { max-height: 0; opacity: 0; }
    to { max-height: 500px; opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-down {
    animation: slideDown 0.3s ease-out;
} 