/* Toast Meta Insights - Frontend Dashboard */

:root {
    --tmi-primary: #2563eb;
    --tmi-success: #10b981;
    --tmi-warning: #f59e0b;
    --tmi-danger: #ef4444;
    --tmi-gray-50: #f9fafb;
    --tmi-gray-100: #f3f4f6;
    --tmi-gray-200: #e5e7eb;
    --tmi-gray-500: #6b7280;
    --tmi-gray-700: #374151;
    --tmi-gray-900: #111827;
}

/* Dashboard Container */
.tmi-dashboard {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    color: var(--tmi-gray-900);
}

/* Header */
.tmi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.tmi-title h1 { margin: 0 0 5px; font-size: 28px; font-weight: 700; }
.tmi-title p { margin: 0; color: var(--tmi-gray-500); font-size: 14px; }

/* Date Filter */
.tmi-date-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tmi-date-filter label {
    font-size: 14px;
    color: var(--tmi-gray-700);
}

.tmi-date-filter input[type="date"] {
    padding: 8px 12px;
    border: 1px solid var(--tmi-gray-200);
    border-radius: 6px;
}

.tmi-quick-dates {
    display: flex;
    gap: 8px;
    margin-left: 10px;
}

.tmi-quick-dates a {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
    color: var(--tmi-gray-700);
    background: var(--tmi-gray-100);
}

.tmi-quick-dates a:hover { background: var(--tmi-gray-200); }

/* Buttons */
.tmi-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: var(--tmi-primary);
    color: white;
}

.tmi-btn:hover { background: #1d4ed8; }
.tmi-btn-full { width: 100%; justify-content: center; }

/* Cards */
.tmi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.tmi-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.tmi-card-icon { font-size: 32px; }

.tmi-card-body h3 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--tmi-gray-500);
    text-transform: uppercase;
}

.tmi-card-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
}

.tmi-card-meta {
    margin-top: 4px;
    font-size: 13px;
    color: var(--tmi-gray-500);
}

.tmi-card-highlight {
    background: linear-gradient(135deg, var(--tmi-primary), #3b82f6);
    color: white;
}

.tmi-card-highlight h3,
.tmi-card-highlight .tmi-card-value,
.tmi-card-highlight .tmi-card-meta { color: white; }

/* Charts */
.tmi-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.tmi-chart-box {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tmi-chart-box h3 { margin: 0 0 20px; font-size: 16px; font-weight: 600; }
.tmi-chart-box canvas { max-height: 300px; }

/* Tables */
.tmi-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.tmi-section h2 { margin: 0 0 20px; font-size: 18px; font-weight: 600; }

.tmi-table-wrap { overflow-x: auto; }

.tmi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.tmi-table th,
.tmi-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--tmi-gray-200);
}

.tmi-table th {
    background: var(--tmi-gray-50);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}

.tmi-table tbody tr:hover { background: var(--tmi-gray-50); }

.positive { color: var(--tmi-success); }
.negative { color: var(--tmi-danger); }

/* Sync Info */
.tmi-sync-info { background: var(--tmi-gray-50); }
.tmi-sync-info h3 { margin: 0 0 15px; font-size: 14px; }

.tmi-sync-log {
    padding: 10px 15px;
    background: white;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.tmi-sync-log .status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
}

.status-success { background: #d1fae5; color: #065f46; }
.status-error { background: #fee2e2; color: #991b1b; }

/* Loading */
.tmi-loading {
    text-align: center;
    padding: 60px 20px;
}

.tmi-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--tmi-gray-200);
    border-top-color: var(--tmi-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

/* Login */
.tmi-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 20px;
}

.tmi-login-box {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

.tmi-login-header {
    text-align: center;
    margin-bottom: 30px;
}

.tmi-login-header h1 { margin: 0 0 10px; font-size: 28px; }
.tmi-login-header p { margin: 0; color: var(--tmi-gray-500); }

.tmi-field { margin-bottom: 20px; }
.tmi-field label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; }

.tmi-field input[type="text"],
.tmi-field input[type="password"],
.tmi-field input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--tmi-gray-200);
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
}

.tmi-field input:focus {
    outline: none;
    border-color: var(--tmi-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tmi-checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.tmi-login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--tmi-gray-200);
}

.tmi-login-footer a { color: var(--tmi-primary); text-decoration: none; font-size: 14px; }

/* Notices */
.tmi-notice {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.tmi-error { background: #fee2e2; color: #991b1b; }
.tmi-success { background: #d1fae5; color: #065f46; }

/* Client Selector */
.tmi-client-selector {
    max-width: 800px;
    margin: 40px auto;
    text-align: center;
}

.tmi-client-selector h1 { margin-bottom: 10px; }
.tmi-client-selector > p { color: var(--tmi-gray-500); margin-bottom: 30px; }

.tmi-client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.tmi-client-card {
    background: white;
    border: 2px solid var(--tmi-gray-200);
    border-radius: 12px;
    padding: 24px;
    text-decoration: none;
    display: block;
}

.tmi-client-card:hover {
    border-color: var(--tmi-primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.tmi-client-card h3 { margin: 0 0 10px; color: var(--tmi-gray-900); }

.tmi-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .tmi-header { flex-direction: column; }
    .tmi-cards { grid-template-columns: 1fr; }
    .tmi-charts { grid-template-columns: 1fr; }
    .tmi-card { flex-direction: column; text-align: center; }
}
