/* ==========================================================================
   Import Note Modal - Import External Notes Feature (2026-01-10)

   ARCHITECTURE: Modal dialog for importing notes from other systems
   WHY: Enable users to import notes with proper historical context
   TRADEOFF: Additional modal vs inline import - modal provides focused UX
   ========================================================================== */

/* Modal container */
.import-note-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1002;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.import-note-modal.visible {
    pointer-events: auto;
    opacity: 1;
}

/* Backdrop */
.import-note-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Main content area */
.inm-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 640px;
    max-height: 85vh;
    background: var(--sol-bg-elevated, #1c1f2a);
    border: 1px solid var(--sol-border, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==========================================================================
   Header
   ========================================================================== */

.inm-header {
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(180deg, rgba(251, 191, 36, 0.1) 0%, transparent 100%);
}

.inm-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--sol-text-primary, #f8fafc);
    margin: 0;
    flex: 1;
}

.inm-patient-name {
    font-size: 0.875rem;
    color: var(--sol-text-secondary, #94a3b8);
}

.inm-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--sol-text-secondary, #94a3b8);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.inm-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--sol-text-primary, #f8fafc);
}

/* ==========================================================================
   Body / Form
   ========================================================================== */

.inm-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.inm-form-group {
    margin-bottom: 20px;
}

.inm-form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--sol-text-primary, #f8fafc);
    margin-bottom: 8px;
}

.inm-row {
    display: flex;
    gap: 16px;
}

.inm-form-group-half {
    flex: 1;
}

.inm-textarea {
    width: 100%;
    min-height: 200px;
    padding: 14px;
    background: var(--sol-bg-base, #0f1219);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--sol-text-primary, #f8fafc);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.inm-textarea:focus {
    outline: none;
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}

.inm-textarea::placeholder {
    color: var(--sol-text-tertiary, #64748b);
}

.inm-char-count {
    font-size: 0.75rem;
    color: var(--sol-text-tertiary, #64748b);
    text-align: right;
    margin-top: 6px;
}

.inm-select,
.inm-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--sol-bg-base, #0f1219);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: var(--sol-text-primary, #f8fafc);
    font-size: 0.875rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.inm-select:focus,
.inm-input:focus {
    outline: none;
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}

.inm-select option {
    background: var(--sol-bg-base, #0f1219);
    color: var(--sol-text-primary, #f8fafc);
}

/* ==========================================================================
   Result Display
   ========================================================================== */

.inm-result {
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
}

.inm-result-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.inm-result-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.inm-success-header {
    font-size: 1rem;
    font-weight: 600;
    color: #86efac;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.inm-success-icon {
    font-size: 1.25rem;
}

.inm-success-details {
    margin-bottom: 12px;
}

.inm-detail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.inm-detail-label {
    font-size: 0.8125rem;
    color: var(--sol-text-secondary, #94a3b8);
}

.inm-detail-value {
    font-size: 0.8125rem;
    color: var(--sol-text-primary, #f8fafc);
}

.inm-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
}

.inm-badge-handp {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.inm-badge-progress {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.inm-badge-discharge {
    background: rgba(168, 85, 247, 0.2);
    color: #c4b5fd;
}

.inm-badge-unknown {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.inm-count {
    font-size: 0.8125rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 8px;
}

.inm-success-note {
    font-size: 0.75rem;
    color: var(--sol-text-tertiary, #64748b);
    font-style: italic;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.inm-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.inm-btn {
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

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

.inm-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--sol-text-primary, #f8fafc);
}

.inm-btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

.inm-btn-primary {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #0f0f0f;
}

.inm-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    transform: translateY(-1px);
}

.inm-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.inm-btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.inm-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-top-color: #0f0f0f;
    border-radius: 50%;
    animation: inm-spin 0.8s linear infinite;
}

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

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

@media (max-width: 640px) {
    .inm-content {
        width: 95%;
        max-height: 90vh;
    }

    .inm-row {
        flex-direction: column;
        gap: 0;
    }

    .inm-form-group-half {
        flex: none;
    }
}
