/* =============================================
   Standardized Modal Styles
   ============================================= */

/* Modal Overlay */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal Container */
.modal-content {
    background: white;
    margin: 5% auto;
    border-radius: 8px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    min-height: 200px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
    position: relative;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal Header (Fixed - doesn't scroll) */
.modal-header {
    padding: 2rem 2rem 1rem 2rem;
    border-bottom: 2px solid #f0f0f0;
    flex-shrink: 0;
    position: relative;
}

.modal-header h2 {
    margin: 0.25rem 0 0.5rem 0;
    font-size: 1.4rem;
    color: #222;
}

.modal-header p {
    margin: 0;
    font-size: 0.85rem;
    color: #888;
}

/* Close Button */
.close {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    color: #999;
    font-size: 26px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
    background: none;
    border: none;
    padding: 0;
}

.close:hover {
    color: #333;
}

/* Modal Body (Scrollable Content) */
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    min-height: 0;
}

/* Modal Footer (Fixed - doesn't scroll) */
.modal-footer {
    padding: 1rem 2rem 2rem 2rem;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.modal-footer a,
.modal-footer button {
    margin: 0;
}

/* Size Variants */
.modal-wide {
    max-width: 780px;
}

.modal-large {
    max-width: 680px;
}

.modal-small {
    max-width: 400px;
}

/* =============================================
   Modal Content Components
   ============================================= */

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.form-group {
    margin-bottom: 1.1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

/* =============================================
   Responsive Design
   ============================================= */

@media (max-width: 768px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
        max-height: 85vh;
    }

    .modal-header {
        padding: 1.5rem 1.5rem 1rem 1.5rem;
    }

    .modal-header h2 {
        font-size: 1.2rem;
    }

    .modal-body {
        padding: 0 1.5rem;
    }

    .modal-footer {
        padding: 1rem 1.5rem 1.5rem 1.5rem;
    }

    .close {
        top: 1rem;
        right: 1rem;
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        margin: 20% auto;
        width: 98%;
        max-height: 75vh;
    }

    .modal-header {
        padding: 1.25rem 1rem 0.75rem 1rem;
        margin-bottom: 1rem;
    }

    .modal-header h2 {
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 0 1rem;
    }

    .modal-footer {
        padding: 0.75rem 1rem 1rem 1rem;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions button {
        width: 100%;
    }
}

/* =============================================
   Setup Wizard Modal Styles
   ============================================= */

.modal-progress {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
}

.wizard-step-content {
    line-height: 1.6;
    color: #333;
    margin-bottom: 1rem;
}

.wizard-credentials-section {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1.5rem;
}

.wizard-credentials-fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.wizard-credentials-fieldset legend {
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: #222;
}

.field-hint {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
    font-style: italic;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #d0d0d0;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
    border-color: #999;
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

