/* ============================================================================
   RECIPE BUILDER MODAL STYLES
   Modal overlay, modal containers, headers, bodies, and footers.
   
   Dependencies: variables.css (for CSS custom properties)
   ============================================================================ */

/* ----------------------------------------------------------------------------
   MODAL OVERLAY
   ---------------------------------------------------------------------------- */

.rb-modal-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* ----------------------------------------------------------------------------
   MODAL CONTAINER
   ---------------------------------------------------------------------------- */

.rb-modal {
    background: var(--rb-bg-surface);
    border-radius: 12px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--rb-border-default);
}

/* Modal Size Variants */
.rb-modal-sm {
    max-width: 500px;
}

.rb-modal-md {
    max-width: 600px;
}

.rb-modal-lg {
    max-width: 700px;
    border-radius: 16px;
    background: var(--rb-bg-base);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* ----------------------------------------------------------------------------
   MODAL HEADER
   ---------------------------------------------------------------------------- */

.rb-modal-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--rb-bg-surface) 0%, var(--rb-bg-base) 100%);
    border-bottom: 1px solid var(--rb-border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rb-modal-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rb-modal-title h3 {
    margin: 0;
    color: var(--rb-text-primary);
    font-size: 1.125rem;
}

/* ----------------------------------------------------------------------------
   MODAL BODY
   ---------------------------------------------------------------------------- */

.rb-modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* ----------------------------------------------------------------------------
   MODAL FOOTER
   ---------------------------------------------------------------------------- */

.rb-modal-footer {
    padding: 1rem 1.5rem;
    background: var(--rb-bg-surface);
    border-top: 1px solid var(--rb-border-default);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ----------------------------------------------------------------------------
   MODAL BUTTONS
   ---------------------------------------------------------------------------- */

.rb-btn-cancel {
    background: #374151;
    border-color: #4b5563;
}

.rb-btn-save {
    background: var(--rb-color-success);
    border-color: #059669;
}

.rb-btn-close {
    background: none;
    border: none;
    color: var(--rb-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.rb-btn-close:hover {
    color: var(--rb-color-error);
}

.rb-btn-close:focus-visible {
    outline: 2px solid var(--rb-text-primary);
    outline-offset: 2px;
}

.rb-btn-close-lg {
    font-size: 1.75rem;
}

.rb-btn-close-md {
    font-size: 1.5rem;
}

/* ----------------------------------------------------------------------------
   VALIDATION
   ---------------------------------------------------------------------------- */

.rb-field-invalid > label {
    color: #f87171 !important;
}

.rb-field-invalid .form-input,
.rb-field-invalid select,
.rb-field-invalid textarea,
.rb-field-invalid input {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.3);
}
