/* Copyright (c) 2025. Jericho Crosby (Chalwk) */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #7e22ce;
    --danger: #dc2626;
    --warning: #d97706;
    --success: #059669;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary);
}

.tagline {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 800px;
    margin: 0 auto 20px;
}

.app-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .app-grid {
        grid-template-columns: 1fr 1fr;
    }

    .full-width {
        grid-column: 1 / -1;
    }
}

.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
}

.card h2 {
    margin-bottom: 16px;
    font-size: 1.4rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h2 svg {
    width: 24px;
    height: 24px;
}

.risk-meter {
    background: linear-gradient(to right, var(--success), var(--warning), var(--danger));
    height: 20px;
    border-radius: 10px;
    margin: 20px 0;
    position: relative;
}

.risk-indicator {
    position: absolute;
    top: -5px;
    width: 30px;
    height: 30px;
    background: white;
    border: 3px solid var(--primary);
    border-radius: 50%;
    transform: translateX(-50%);
    transition: left 0.5s ease;
}

.risk-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.risk-score {
    text-align: center;
    font-size: 2.5rem;
    font-weight: bold;
    margin: 20px 0;
    color: var(--primary);
}

.risk-level {
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    padding: 10px;
    border-radius: var(--radius);
}

.low-risk {
    background-color: #d1fae5;
    color: var(--success);
}

.medium-risk {
    background-color: #fef3c7;
    color: var(--warning);
}

.high-risk {
    background-color: #fee2e2;
    color: var(--danger);
}

.critical-risk {
    background-color: #fecaca;
    color: var(--danger);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

.factor-group {
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px;
    background: var(--bg-light);
}

.factor-group h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--secondary);
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border);
}

.question {
    margin-bottom: 15px;
    padding: 15px;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.question-text {
    margin-bottom: 10px;
    font-weight: 500;
}

.question-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-style: italic;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.slider {
    flex: 1;
    -webkit-appearance: none;
    height: 8px;
    border-radius: 4px;
    background: var(--border);
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.slider-value {
    min-width: 30px;
    text-align: center;
    font-weight: bold;
    color: var(--primary);
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    background: var(--primary-dark);
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.btn-ghost {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-ghost:hover {
    background: var(--bg-light);
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.recommendations-list {
    list-style-type: none;
}

.recommendations-list li {
    margin-bottom: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.history-item {
    padding: 15px;
    margin-bottom: 15px;
    border-radius: var(--radius);
    background: var(--bg-light);
    border-left: 4px solid var(--success);
}

.history-item.medium {
    border-left-color: var(--warning);
}

.history-item.high {
    border-left-color: var(--danger);
}

.history-item.critical {
    border-left-color: var(--danger);
    background: #fef2f2;
}

.history-date {
    font-weight: bold;
    margin-bottom: 5px;
}

.history-score {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.progress-bar {
    height: 10px;
    background: var(--border);
    border-radius: 5px;
    margin-top: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.trend-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-left: 10px;
}

.trend-up {
    background: #fee2e2;
    color: var(--danger);
}

.trend-down {
    background: #d1fae5;
    color: var(--success);
}

.trend-stable {
    background: #fef3c7;
    color: var(--warning);
}

.tab-container {
    margin-top: 20px;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.tab.active {
    border-bottom: 3px solid var(--primary);
    font-weight: bold;
    color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.warning-note {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: var(--radius);
    padding: 15px;
    margin: 20px 0;
    color: #92400e;
}

.emergency-contact {
    background: #fee2e2;
    border: 1px solid #ef4444;
    border-radius: var(--radius);
    padding: 15px;
    margin: 20px 0;
    color: #b91c1c;
}

.emergency-contact h3 {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.factor-breakdown {
    margin-top: 20px;
}

.factor-breakdown-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.factor-name {
    font-weight: 500;
}

.factor-score {
    font-weight: bold;
    color: var(--primary);
}

.collapse-toggle {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    margin-bottom: 10px;
}

.collapse-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapse-content.collapsed {
    max-height: 0;
}

.risk-chart {
    height: 200px;
    margin: 20px 0;
    position: relative;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-muted);
    color: white;
    font-size: 12px;
    margin-left: 5px;
    cursor: help;
}

.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 250px;
    background-color: var(--text);
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -125px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
    font-weight: normal;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

.priority-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-left: 8px;
}

.priority-high {
    background: #fee2e2;
    color: var(--danger);
}

.priority-medium {
    background: #fef3c7;
    color: var(--warning);
}

.priority-low {
    background: #d1fae5;
    color: var(--success);
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.resource-card {
    background: var(--bg-light);
    border-radius: var(--radius);
    padding: 15px;
    border-left: 4px solid var(--primary);
}

.resource-card h4 {
    margin-bottom: 8px;
    color: var(--primary);
}

.resource-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.resource-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.resource-link:hover {
    text-decoration: underline;
}