/* Title Monitor — Horizon UI Design System */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&display=swap');

:root {
    --brand-500: #422AFB;
    --brand-400: #7551FF;
    --brand-50: #E9E3FF;
    --bg-primary: #F4F7FE;
    --bg-white: #ffffff;
    --navy-700: #1B254B;
    --gray-600: #a3aed0;
    --gray-700: #707eae;
    --gray-200: #e9ecef;
    --green-500: #22c55e;
    --red-500: #f53939;
    --orange-500: #f97316;
    --shadow-card: 0 14px 17px 4px rgba(112, 144, 176, 0.08);
    --radius-card: 20px;
    --radius-lg: 12px;
}

* { box-sizing: border-box; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-primary);
    color: var(--gray-700);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.5px;
}

.tm-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 32px 24px;
}

.tm-header {
    margin-bottom: 28px;
}
.tm-header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--navy-700);
    margin: 0 0 6px;
    letter-spacing: -0.5px;
}
.tm-header p {
    color: var(--gray-600);
    font-size: 14px;
    margin: 0;
}

/* Cards */
.tm-card {
    background: var(--bg-white);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 28px;
    margin-bottom: 20px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.tm-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 25px -5px rgba(112, 144, 176, 0.12);
}
.tm-card h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--navy-700);
    margin: 0 0 16px;
}

/* Form */
.tm-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}
.tm-field {
    flex: 1 1 300px;
    display: flex;
    flex-direction: column;
    position: relative;
}
.tm-field-small {
    flex: 0 0 130px;
}
.tm-field label {
    font-size: 14px;
    font-weight: 500;
    color: var(--navy-700);
    margin-bottom: 8px;
    padding-left: 4px;
}
.tm-field input {
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    background: transparent;
    color: var(--navy-700);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.tm-field input:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(66, 42, 251, 0.1);
}
.tm-field input::placeholder {
    color: var(--gray-600);
}

/* Suggestions */
.tm-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: var(--shadow-card);
}
.tm-suggestions.active {
    display: block;
}
.tm-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
    color: var(--navy-700);
    transition: background 0.15s;
}
.tm-suggestion-item:hover {
    background: var(--bg-primary);
}
.tm-suggestion-item:last-child {
    border-bottom: none;
}

/* Buttons */
.tm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 24px;
    border: none;
    border-radius: var(--radius-lg);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.tm-btn-primary {
    background: var(--brand-500);
    color: #ffffff;
    box-shadow: 0 4px 6px rgba(66, 42, 251, 0.2);
}
.tm-btn-primary:hover {
    background: #3311DB;
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(66, 42, 251, 0.25);
}
.tm-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.tm-btn-sm {
    height: 32px;
    padding: 0 14px;
    font-size: 13px;
}
.tm-btn-danger {
    background: rgba(245, 57, 57, 0.1);
    color: var(--red-500);
}
.tm-btn-danger:hover {
    background: rgba(245, 57, 57, 0.2);
}
.tm-btn-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--green-500);
}
.tm-btn-success:hover {
    background: rgba(34, 197, 94, 0.2);
}

/* Alerts Section */
.tm-alerts-section {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-card);
    padding: 24px;
    margin-bottom: 20px;
}
.tm-alerts-section h2 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #92400e;
}
.tm-alert-item {
    background: var(--bg-white);
    border-left: 4px solid var(--orange-500);
    padding: 14px;
    margin-bottom: 8px;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
.tm-alert-item.new { border-left-color: var(--green-500); }
.tm-alert-item.removed { border-left-color: var(--red-500); }
.tm-alert-item.changed { border-left-color: #17c1e8; }

/* Monitors */
.tm-monitors-list {
    display: grid;
    gap: 16px;
}
.tm-monitor-card {
    background: var(--bg-white);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.2s;
}
.tm-monitor-card:hover {
    transform: translateY(-2px);
}
.tm-monitor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.tm-monitor-address {
    font-weight: 700;
    font-size: 16px;
    color: var(--navy-700);
}
.tm-monitor-title {
    color: var(--gray-600);
    font-size: 13px;
    margin-top: 2px;
}
.tm-monitor-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--gray-600);
    flex-wrap: wrap;
}
.tm-monitor-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}
.tm-progress-bar {
    width: 160px;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}
.tm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-500), var(--brand-400));
    border-radius: 4px;
    transition: width 0.3s;
}
.tm-monitor-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

/* Memorials expandable */
.tm-memorials-toggle {
    background: transparent;
    border: none;
    color: var(--brand-500);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tm-memorials-toggle:hover {
    text-decoration: underline;
}
.tm-memorials-panel {
    margin-top: 8px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    display: none;
}
.tm-memorials-panel.active {
    display: block;
}
.tm-memorials-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.tm-memorials-table th,
.tm-memorials-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--gray-200);
}
.tm-memorials-table th {
    color: var(--navy-700);
    font-weight: 600;
    background: rgba(255,255,255,0.6);
}
.tm-memorials-table td {
    color: var(--gray-700);
}
.tm-memorial-text {
    max-width: 400px;
    word-break: break-word;
    line-height: 1.4;
}

/* Memorial type highlights */
.tm-memorial-row--mortgage {
    background: rgba(245, 57, 57, 0.06);
}
.tm-memorial-row--mortgage td:first-child {
    border-left: 3px solid var(--red-500);
    padding-left: 7px;
}
.tm-memorial-row--easement {
    background: rgba(249, 115, 22, 0.06);
}
.tm-memorial-row--easement td:first-child {
    border-left: 3px solid var(--orange-500);
    padding-left: 7px;
}
.tm-memorial-row--caveat {
    background: rgba(245, 158, 11, 0.08);
}
.tm-memorial-row--caveat td:first-child {
    border-left: 3px solid #f59e0b;
    padding-left: 7px;
}

.tm-memorials-table tr:last-child td {
    border-bottom: none;
}
.tm-memorials-empty {
    color: var(--gray-600);
    font-size: 13px;
    padding: 8px 0;
}
.tm-memorials-loading {
    color: var(--gray-600);
    font-size: 13px;
    padding: 8px 0;
}

.tm-empty {
    text-align: center;
    color: var(--gray-600);
    padding: 48px;
    background: var(--bg-white);
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-card);
    font-size: 14px;
}

.tm-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.tm-badge-active { background: rgba(34, 197, 94, 0.1); color: var(--green-500); }
.tm-badge-paused { background: rgba(245, 158, 11, 0.1); color: var(--orange-500); }
.tm-badge-completed { background: var(--bg-primary); color: var(--gray-600); }
.tm-badge-error { background: rgba(245, 57, 57, 0.1); color: var(--red-500); }

/* Status Banner */
.tm-status-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
}
.tm-status-banner.info {
    background: var(--brand-50);
    color: var(--brand-500);
    border: 1px solid var(--brand-50);
}
.tm-status-banner.warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

@media (max-width: 640px) {
    .tm-container { padding: 16px; }
    .tm-form { flex-direction: column; }
    .tm-field, .tm-field-small { flex: 1 1 100%; }
}
