/* ═══════════════════════════════════════════════════════════════════════════
   MODAL CONTRATAR — Resérvame
   Premium multi-step registration modal with logo cropper + PDF upload
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Overlay ─────────────────────────────────────────────────────────────── */
#modal-contratar {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.25s ease;
}

#modal-contratar.open {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.mc-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 720px;
    height: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#mc-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(32px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.mc-header {
    padding: 1.75rem 2rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-shrink: 0;
}

.mc-header-left h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: #f1f5f9;
    margin: 0 0 0.2rem;
    letter-spacing: -0.02em;
}

.mc-header-left p {
    font-size: 0.82rem;
    color: #64748b;
    margin: 0;
}

.mc-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.mc-close:hover {
    background: rgba(255, 77, 106, 0.15);
    color: #ff4d6a;
    border-color: rgba(255, 77, 106, 0.3);
}

/* ── Step Indicator ────────────────────────────────────────────────────────── */
.mc-steps {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 1rem 2rem;
    border-bottom: 2px solid rgba(164, 198, 21, 0.1);
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.mc-steps::-webkit-scrollbar {
    display: none;
}

.mc-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.25s;
}

.mc-step.active {
    opacity: 1;
}

.mc-step.done {
    opacity: 0.7;
}

.mc-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    transition: all 0.25s;
}

.mc-step.active .mc-step-num {
    background: rgba(164, 198, 21, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

.mc-step.done .mc-step-num {
    background: rgba(164, 198, 21, 0.1);
    border-color: rgba(164, 198, 21, 0.4);
    color: var(--primary);
}

.mc-step-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    white-space: nowrap;
}

.mc-step.active .mc-step-label {
    color: var(--text);
}

.mc-step.done .mc-step-label {
    color: var(--primary);
}

.mc-step-sep {
    flex: 1;
    min-width: 20px;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 0.5rem;
}

/* ── Body ─────────────────────────────────────────────────────────────────── */
.mc-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(16, 185, 129, 0.3) transparent;
}

.mc-body::-webkit-scrollbar {
    width: 4px;
}

.mc-body::-webkit-scrollbar-track {
    background: transparent;
}

.mc-body::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.3);
    border-radius: 2px;
}

/* ── Step Panels ──────────────────────────────────────────────────────────── */
.mc-panel {
    display: none;
    animation: panelIn 0.25s ease;
}

.mc-panel.active {
    display: block;
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateX(12px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.mc-section-title {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.mc-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(164, 198, 21, 0.15);
}

.mc-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 560px) {
    .mc-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ── Form Elements ───────────────────────────────────────────────────────── */
.mc-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.25rem;
}

.mc-field.full {
    grid-column: 1 / -1;
}

.mc-field label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mc-field label span.req {
    color: #f87171;
    margin-left: 2px;
}

.mc-field input,
.mc-field select,
.mc-field textarea {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0.65rem 0.9rem;
    color: #f1f5f9;
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}

/* Force uppercase on ID fields */
input[name="Titular_RUT"],
input[name="Empresa_RUT"] {
    text-transform: uppercase;
}

.mc-field input:focus,
.mc-field select:focus,
.mc-field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(164, 198, 21, 0.08);
}

.mc-field input::placeholder {
    color: #475569;
}

.mc-field select option {
    background: #1e293b;
}

/* ── Logo Upload Area ────────────────────────────────────────────────────── */
.mc-logo-upload {
    margin-bottom: 1.25rem;
}

.mc-drop-zone {
    border: 2px dashed rgba(164, 198, 21, 0.25);
    border-radius: 14px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
    background: rgba(164, 198, 21, 0.03);
    position: relative;
}

.mc-drop-zone:hover,
.mc-drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(164, 198, 21, 0.06);
}

.mc-drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.mc-drop-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(164, 198, 21, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    color: var(--primary);
}

.mc-drop-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.mc-drop-text strong {
    color: var(--primary);
}

.mc-drop-hint {
    font-size: 0.7rem;
    color: #475569;
    margin-top: 0.3rem;
}

/* ── Cropper Container ───────────────────────────────────────────────────── */
.mc-cropper-wrap {
    display: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 1rem;
    background: var(--bg-deep);
}

.mc-cropper-wrap.show {
    display: block;
}

#mc-cropper-canvas {
    width: 100%;
    max-height: 280px;
    display: block;
}

.mc-cropper-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    gap: 0.75rem;
    flex-wrap: wrap;
}

.mc-crop-info {
    font-size: 0.7rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.mc-crop-info strong {
    color: var(--primary);
}

.mc-cropper-actions {
    display: flex;
    gap: 0.5rem;
}

.mc-preview-strip {
    display: none;
    margin-top: 0.75rem;
}

.mc-preview-strip.show {
    display: block;
}

.mc-preview-box {
    width: 100%;
    aspect-ratio: 800 / 220;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(164, 198, 21, 0.25);
    background: #000;
}

.mc-preview-box canvas,
.mc-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Changed from cover to contain to ensure full logo is visible */
}

/* ── PDF Upload ──────────────────────────────────────────────────────────── */
.mc-pdf-zone {
    border: 2px dashed rgba(99, 102, 241, 0.25);
    border-radius: 14px;
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
    background: rgba(99, 102, 241, 0.03);
    position: relative;
}

.mc-pdf-zone:hover,
.mc-pdf-zone.dragover {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.06);
}

.mc-pdf-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.mc-pdf-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.6rem;
    color: #818cf8;
}

.mc-file-selected {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.9rem;
    background: rgba(164, 198, 21, 0.08);
    border: 1px solid rgba(164, 198, 21, 0.2);
    border-radius: 8px;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--primary);
}

.mc-file-selected.show {
    display: flex;
}

.mc-file-selected svg {
    flex-shrink: 0;
}

/* ── Terms Checkbox ──────────────────────────────────────────────────────── */
.mc-terms {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(164, 198, 21, 0.04);
    border: 1px solid rgba(164, 198, 21, 0.12);
    border-radius: 12px;
    margin-top: 1rem;
    cursor: pointer;
}

.mc-terms input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

.mc-terms p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.mc-terms p a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── Footer / Buttons ────────────────────────────────────────────────────── */
.mc-footer {
    padding: 1.25rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.mc-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.4rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.mc-btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mc-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

.mc-btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--bg-deep);
    box-shadow: 0 4px 16px rgba(164, 198, 21, 0.3);
}

.mc-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(164, 198, 21, 0.4);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.mc-btn-primary:active {
    transform: translateY(0);
}

.mc-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#mc-back-btn {
    display: none;
}

/* ── Progress Bar ────────────────────────────────────────────────────────── */
.mc-progress-bar {
    height: 3px;
    background: rgba(16, 185, 129, 0.1);
    position: relative;
    flex-shrink: 0;
}

.mc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 0 2px 2px 0;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Form Message ────────────────────────────────────────────────────────── */
#mc-msg {
    font-size: 0.82rem;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    display: none;
    align-items: center;
    gap: 0.4rem;
}

#mc-msg.show {
    display: flex;
}

#mc-msg.success {
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
}

#mc-msg.error {
    color: #f87171;
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

/* ── Field Specific Errors ── */
.field-error-msg {
    color: #f87171;
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 4px;
    display: none;
    animation: fadeIn 0.2s ease;
}

.field-error-msg.show {
    display: block;
}

.mc-field input.error, 
.form-group input.error {
    border-color: #f87171 !important;
    background: rgba(248, 113, 113, 0.04) !important;
}

/* ── Success State ───────────────────────────────────────────────────────── */
#mc-success-panel {
    text-align: center;
    padding: 2.5rem 1rem;
    display: none;
}

#mc-success-panel.show {
    display: block;
}

.mc-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(164, 198, 21, 0.15);
    border: 2px solid rgba(164, 198, 21, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    color: var(--primary);
}

#mc-success-panel h3 {
    font-size: 1.3rem;
    font-weight: 800;
    color: #f1f5f9;
    margin-bottom: 0.5rem;
}

#mc-success-panel p {
    font-size: 0.88rem;
    color: #64748b;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

/* ── Light Mode ──────────────────────────────────────────────────────────── */
[data-theme="light"] .mc-card {
    background: #ffffff;
    border-color: rgba(16, 185, 129, 0.2);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .mc-header-left h2 {
    color: #0f172a;
}

[data-theme="light"] .mc-field input,
[data-theme="light"] .mc-field select,
[data-theme="light"] .mc-field textarea {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #0f172a;
}

[data-theme="light"] .mc-field select option {
    background: #ffffff;
    color: #0f172a;
}

[data-theme="light"] .mc-field input::placeholder {
    color: #94a3b8;
}

[data-theme="light"] #modal-contratar {
    background: rgba(15, 23, 42, 0.6);
}

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.mc-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mc-spin 0.6s linear infinite;
    display: none;
}

.mc-spinner.show {
    display: inline-block;
}

@keyframes mc-spin {
    to {
        transform: rotate(360deg);
    }
}