/* ==========================================================================
   AutoScore Telegram MiniApp — Premium Light Theme Stylesheet
   ========================================================================== */

:root {
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --card-bg-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --border-blue: rgba(37, 99, 235, 0.3);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --accent-blue: #2563eb;
    --accent-purple: #7c3aed;
    --accent-warning: #d97706;
    --accent-success: #059669;
    --accent-danger: #dc2626;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    padding-bottom: 30px;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

/* Telegram Header */
.tma-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.tma-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tma-icon {
    font-size: 26px;
}

.tma-title {
    font-family: var(--font-heading);
    font-size: 19px;
    font-weight: 800;
    color: var(--accent-blue);
    letter-spacing: -0.3px;
}

.tma-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
}

.tma-refresh-btn {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
}

.tma-refresh-btn:active {
    transform: scale(0.92);
    background: #e2e8f0;
}

/* Container */
.tma-container {
    padding: 16px;
}

.tma-section-title {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    margin: 18px 0 12px 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tma-section-title i {
    color: var(--accent-blue);
}

/* Stats Grid */
.tma-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.tma-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.tma-stat-card.primary { border-top: 3.5px solid var(--accent-blue); }
.tma-stat-card.purple { border-top: 3.5px solid var(--accent-purple); }
.tma-stat-card.warning { border-top: 3.5px solid var(--accent-warning); }
.tma-stat-card.success { border-top: 3.5px solid var(--accent-success); }

.tma-stat-val {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.tma-stat-card.primary .tma-stat-val { color: var(--accent-blue); }
.tma-stat-card.purple .tma-stat-val { color: var(--accent-purple); }
.tma-stat-card.warning .tma-stat-val { color: var(--accent-warning); }
.tma-stat-card.success .tma-stat-val { color: var(--accent-success); }

.tma-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Cards */
.tma-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.tma-card-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 14px;
}

/* Pipeline Steps */
.tma-pipeline-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tma-step {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tma-step.warning { border-color: #fde68a; background: #fffbeb; }
.tma-step.success { border-color: #a7f3d0; background: #ecfdf5; }

.tma-step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #e2e8f0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
}

.tma-step.warning .tma-step-num { background: #f59e0b; color: #ffffff; }
.tma-step.success .tma-step-num { background: #10b981; color: #ffffff; }

.tma-step-body {
    flex: 1;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-primary);
}

.tma-step-body span {
    color: var(--text-secondary);
    font-weight: 500;
}

.tma-step-body strong {
    font-size: 15px;
    color: var(--text-primary);
}

/* Claims Cards List */
.tma-claims-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tma-claim-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.tma-claim-card:hover, .tma-claim-card:active {
    background: var(--card-bg-hover);
    border-color: var(--accent-blue);
    transform: translateY(-1px);
}

.tma-claim-info h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.tma-claim-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.tma-claim-status {
    text-align: right;
}

.tma-claim-status div {
    color: var(--text-primary);
    font-weight: 700;
}

.tma-pill {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

.tma-pill.manual_review { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }
.tma-pill.completed { background: #d1fae5; color: #047857; border: 1px solid #6ee7b7; }
.tma-pill.analyzing { background: #f3e8ff; color: #6b21a8; border: 1px solid #d8b4fe; }
.tma-pill.failed { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

/* Bottom Sheet Modal */
.tma-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.tma-sheet-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.tma-sheet-content {
    width: 100%;
    background: #ffffff;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    border-top: 3px solid var(--accent-blue);
    padding: 16px 20px 30px 20px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
    max-height: 85vh;
    overflow-y: auto;
    color: var(--text-primary);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
}

.tma-sheet-overlay.active .tma-sheet-content {
    transform: translateY(0);
}

.tma-sheet-handle {
    width: 44px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 3px;
    margin: 0 auto 16px auto;
}

.tma-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.tma-sheet-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.tma-sheet-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 26px;
    cursor: pointer;
}

.tma-car-banner {
    width: 100%;
    height: 170px;
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.tma-car-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tma-car-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 14px;
    background: linear-gradient(transparent, rgba(15, 23, 42, 0.85));
}

.tma-car-overlay h4 {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
}

.tma-car-overlay span {
    font-size: 12px;
    color: #cbd5e1;
}

.tma-sheet-section {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
}

.tma-sheet-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.tma-sheet-row:last-child {
    margin-bottom: 0;
}

.tma-input {
    width: 100%;
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid var(--accent-blue);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    margin-top: 6px;
    outline: none;
}

.tma-sheet-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}

.tma-btn {
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

.tma-btn:active {
    transform: scale(0.96);
}

.tma-btn-success { background: linear-gradient(135deg, #059669 0%, #047857 100%); color: #ffffff; box-shadow: 0 4px 15px rgba(5, 150, 105, 0.25); }
.tma-btn-danger { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); color: #ffffff; box-shadow: 0 4px 15px rgba(220, 38, 38, 0.25); }
