/* Preferences Modal Styles */

/* Modal container styling */
#preferencesModalContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#preferencesModalContainer.hidden {
    display: none !important;
}

/* Preferences sections */
.preferences-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
}

.preferences-section:not(:last-child) {
    border-bottom: 1px solid #e9ecef;
}

.preferences-section h4 {
    margin: 0 0 8px 0;
    color: #495057;
    font-size: 1.1em;
    font-weight: 600;
}

.preferences-section p {
    margin: 0 0 20px 0;
    color: #6c757d;
    line-height: 1.5;
    font-size: 14px;
}

/* Form styling */
.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #495057;
    font-weight: 500;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    color: #495057;
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.form-control:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* Preview sections */
.preview-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-label {
    color: #6c757d;
    font-weight: 500;
    font-size: 14px;
}

.preview-value {
    color: #007bff;
    font-weight: 600;
    font-size: 16px;
    font-family: 'Courier New', monospace;
}

/* Error messaging */
.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin-top: 8px;
    margin-bottom: 16px;
}

.error-message.hidden {
    display: none;
}

/* Modal footer styling */
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.button-group {
    display: flex;
    gap: 12px;
}

/* Button styling for preferences modal */
#preferencesModalContainer .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.2;
}

#preferencesModalContainer .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

#preferencesModalContainer .btn-primary {
    background: #007bff;
    color: white;
}

#preferencesModalContainer .btn-primary:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

#preferencesModalContainer .btn-secondary {
    background: #6c757d;
    color: white;
}

#preferencesModalContainer .btn-secondary:hover:not(:disabled) {
    background: #545b62;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2);
}

#preferencesModalContainer .btn-tertiary {
    background: transparent;
    color: #6c757d;
    border: 1px solid #ced4da;
}

#preferencesModalContainer .btn-tertiary:hover:not(:disabled) {
    background: #f8f9fa;
    color: #495057;
    border-color: #adb5bd;
}

#preferencesModalContainer .btn-icon {
    padding: 8px;
    background: transparent;
    color: #6c757d;
    border-radius: 4px;
    min-width: auto;
}

#preferencesModalContainer .btn-icon:hover {
    background: #f8f9fa;
    color: #495057;
}

/* Progress indicator */
.save-progress {
    margin-top: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.save-progress.hidden {
    display: none;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 3px;
    transition: width 0.3s ease, background 0.3s ease;
    width: 0%;
}

.save-progress p {
    margin: 0;
    color: #495057;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

/* Modal size adjustment for preferences modal */
#preferencesModalContainer .modal-content {
    max-width: 600px;
    width: 90vw;
}

/* Responsive design */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .button-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .preview-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .preview-value {
        font-size: 14px;
    }
    
    #preferencesModalContainer .modal-content {
        width: 95vw;
        margin: 10px;
    }
}

/* Focus management and accessibility */
#preferencesModalContainer .form-control:focus,
#preferencesModalContainer .btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Select dropdown styling */
#preferencesModalContainer select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px 16px;
    padding-right: 32px;
    appearance: none;
}

#preferencesModalContainer select.form-control:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23007bff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

/* Animation for modal appearance */
@keyframes preferencesModalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#preferencesModalContainer .modal-content {
    animation: preferencesModalFadeIn 0.3s ease-out;
}

/* Success state for progress */
.progress-fill.success {
    background: linear-gradient(90deg, #28a745, #1e7e34) !important;
}

.save-progress.success {
    background: #d4edda;
    border-color: #c3e6cb;
}

.save-progress.success p {
    color: #155724;
}
