/* Medical Tourism Manager - Styles */
:root {
    --mtm-primary: #2563eb;
    --mtm-primary-dark: #1d4ed8;
    --mtm-success: #16a34a;
    --mtm-danger: #dc2626;
    --mtm-warning: #d97706;
    --mtm-gray: #6b7280;
    --mtm-light: #f3f4f6;
    --mtm-border: #e5e7eb;
    --mtm-white: #ffffff;
    --mtm-shadow: 0 1px 3px rgba(0,0,0,0.12);
    --mtm-radius: 8px;
}

#mtm-app * { box-sizing: border-box; }

#mtm-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #111827;
    background: var(--mtm-light);
    min-height: 100vh;
    padding: 20px;
}

/* Header */
.mtm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--mtm-white);
    padding: 16px 24px;
    border-radius: var(--mtm-radius);
    box-shadow: var(--mtm-shadow);
    margin-bottom: 20px;
}
.mtm-header h1 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--mtm-primary);
}
.mtm-badge {
    background: var(--mtm-primary);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Toolbar */
.mtm-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.mtm-search {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid var(--mtm-border);
    border-radius: var(--mtm-radius);
    font-size: 0.9rem;
}
.mtm-search:focus { outline: none; border-color: var(--mtm-primary); }

/* Buttons */
.mtm-btn {
    padding: 8px 16px;
    border-radius: var(--mtm-radius);
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.mtm-btn-primary { background: var(--mtm-primary); color: white; }
.mtm-btn-primary:hover { background: var(--mtm-primary-dark); }
.mtm-btn-success { background: var(--mtm-success); color: white; }
.mtm-btn-danger  { background: var(--mtm-danger); color: white; }
.mtm-btn-ghost   { background: transparent; color: var(--mtm-primary); border: 1px solid var(--mtm-primary); }
.mtm-btn-sm      { padding: 4px 10px; font-size: 0.8rem; }
.mtm-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Table */
.mtm-table-wrap {
    background: var(--mtm-white);
    border-radius: var(--mtm-radius);
    box-shadow: var(--mtm-shadow);
    overflow: auto;
}
.mtm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.mtm-table th {
    background: #f8fafc;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--mtm-gray);
    border-bottom: 2px solid var(--mtm-border);
    white-space: nowrap;
}
.mtm-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--mtm-border);
    vertical-align: middle;
}
.mtm-table tr:hover td { background: #f9fafb; }
.mtm-table tr:last-child td { border-bottom: none; }

/* Status chips */
.mtm-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.mtm-chip-green  { background: #dcfce7; color: #166534; }
.mtm-chip-red    { background: #fee2e2; color: #991b1b; }
.mtm-chip-blue   { background: #dbeafe; color: #1e40af; }
.mtm-chip-yellow { background: #fef9c3; color: #854d0e; }
.mtm-chip-gray   { background: #f3f4f6; color: #374151; }

/* Confirm buttons for hotel/transport */
.mtm-confirm-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
}
.mtm-confirm-btn.pending { background: #fef3c7; color: #92400e; }
.mtm-confirm-btn.done    { background: #d1fae5; color: #065f46; cursor: default; }

/* Modal */
.mtm-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 99999;
    padding: 16px;
}
.mtm-modal {
    background: var(--mtm-white);
    border-radius: 12px;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.mtm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--mtm-border);
    position: sticky; top: 0; background: white; z-index: 1;
}
.mtm-modal-header h2 { margin: 0; font-size: 1.1rem; }
.mtm-modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.4rem; color: var(--mtm-gray); line-height: 1;
}
.mtm-modal-body { padding: 24px; }

/* Form */
.mtm-form-section {
    margin-bottom: 24px;
}
.mtm-form-section h3 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--mtm-gray);
    margin: 0 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--mtm-border);
}
.mtm-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.mtm-field { display: flex; flex-direction: column; gap: 4px; }
.mtm-field label { font-size: 0.8rem; font-weight: 600; color: #374151; }
.mtm-field input,
.mtm-field select,
.mtm-field textarea {
    padding: 8px 10px;
    border: 1px solid var(--mtm-border);
    border-radius: 6px;
    font-size: 0.875rem;
    color: #111827;
    background: white;
    transition: border-color 0.15s;
}
.mtm-field input:focus,
.mtm-field select:focus,
.mtm-field textarea:focus {
    outline: none;
    border-color: var(--mtm-primary);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}
.mtm-field input[readonly],
.mtm-field select[disabled],
.mtm-field textarea[readonly] {
    background: #f9fafb;
    color: var(--mtm-gray);
    cursor: not-allowed;
}
.mtm-field textarea { resize: vertical; min-height: 80px; }
.mtm-checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; }
.mtm-checkbox-item {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.85rem; cursor: pointer;
}
.mtm-checkbox-item input { width: 16px; height: 16px; cursor: pointer; }

/* Full-width field */
.mtm-field-full { grid-column: 1 / -1; }

/* Pagination */
.mtm-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--mtm-border);
    font-size: 0.85rem;
    color: var(--mtm-gray);
}
.mtm-page-btns { display: flex; gap: 6px; }
.mtm-page-btn {
    padding: 4px 10px;
    border: 1px solid var(--mtm-border);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.8rem;
}
.mtm-page-btn.active { background: var(--mtm-primary); color: white; border-color: var(--mtm-primary); }
.mtm-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Users table */
.mtm-role-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #ede9fe;
    color: #4c1d95;
}

/* Loader */
.mtm-loading {
    text-align: center;
    padding: 40px;
    color: var(--mtm-gray);
    font-size: 0.9rem;
}
.mtm-loading::before {
    content: '';
    display: inline-block;
    width: 20px; height: 20px;
    border: 2px solid var(--mtm-border);
    border-top-color: var(--mtm-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Notices */
.mtm-notice {
    padding: 10px 16px;
    border-radius: var(--mtm-radius);
    margin-bottom: 16px;
    font-size: 0.875rem;
}
.mtm-notice-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.mtm-notice-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* View-only field value */
.mtm-view-val {
    padding: 8px 10px;
    background: #f9fafb;
    border: 1px solid var(--mtm-border);
    border-radius: 6px;
    font-size: 0.875rem;
    color: #374151;
    min-height: 36px;
}

/* Health condition flags in table */
.mtm-health-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--mtm-danger);
    margin-right: 3px;
    vertical-align: middle;
}

/* Tabs */
.mtm-tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid var(--mtm-border); }
.mtm-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--mtm-gray);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.mtm-tab.active { color: var(--mtm-primary); border-bottom-color: var(--mtm-primary); }

/* Empty state */
.mtm-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--mtm-gray);
}
.mtm-empty-icon { font-size: 3rem; margin-bottom: 12px; }
.mtm-empty h3 { margin: 0 0 6px; }

/* Modal footer */
.mtm-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--mtm-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: white;
}

/* Responsive */
@media (max-width: 640px) {
    #mtm-app { padding: 10px; }
    .mtm-form-grid { grid-template-columns: 1fr; }
    .mtm-modal { max-width: 100%; }
}

.mtm-revealable:hover {
    color: var(--mtm-primary-dark) !important;
    background: #eff6ff;
}
.mtm-admin-status-reset:hover {
    color: #f87171 !important;
}
