/* Copyright (c) 2024-2026. Jericho Crosby (Chalwk) */

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

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

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

.card {
    background: var(--light);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-light);
    transition: transform 0.3s ease;
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

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

.card h2 svg {
    color: var(--primary);
    width: 24px;
    height: 24px;
}

.risk-meter {
    background: linear-gradient(to right, var(--success), var(--warning), var(--error));
    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;
    left: 50%;
}

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

.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: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.medium-risk {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.high-risk {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.critical-risk {
    background-color: rgba(239, 68, 68, 0.2);
    color: var(--error);
    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(--gray-light);
    border-radius: var(--radius);
    padding: 15px;
    background: var(--light);
}

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

.question {
    margin-bottom: 15px;
    padding: 15px;
    background: 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(--gray);
    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(--gray-light);
    outline: none;
}

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

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

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

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

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

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

.recommendations-list li {
    margin-bottom: 12px;
    padding: 12px;
    background: var(--light);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

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

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

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

.history-item.critical {
    border-left-color: var(--error);
    background: rgba(239, 68, 68, 0.05);
}

.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(--gray-light);
    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: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.trend-down {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.trend-stable {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

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

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

.tab {
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    color: var(--gray);
    font-weight: 500;
}

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

.tab-content {
    display: none;
}

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

.warning-note {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: 15px;
    margin: 20px 0;
    color: #92400e;
}

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

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

.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;
    width: 100%;
    text-align: left;
    padding: 5px;
    border-radius: var(--radius-sm);
}

.collapse-toggle:hover {
    background: rgba(37, 99, 235, 0.05);
}

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

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

.collapse-icon {
    transition: transform 0.3s ease;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gray);
    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(--dark);
    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;
    white-space: nowrap;
}

.priority-high {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.priority-medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.priority-low {
    background: rgba(16, 185, 129, 0.1);
    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(--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(--gray);
    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;
    color: var(--primary-dark);
}

.history-empty {
    text-align: center;
    padding: 2rem;
    color: var(--gray);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 10px;
}

.history-risk {
    font-weight: bold;
}

.history-score-total {
    margin-bottom: 0.5rem;
}

.history-scores {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.factor-score {
    font-size: 0.9rem;
    color: var(--gray);
}

.slider.unanswered {
    border: 2px solid var(--error);
    border-radius: 4px;
}

.slider.answered {
    border: 2px solid var(--success);
    border-radius: 4px;
}

#calculate-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#recommendations-card {
    display: none;
}

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

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

.emergency-contact h3 svg {
    width: 20px;
    height: 20px;
}

.emergency-contact ul {
    margin-top: 10px;
    margin-left: 20px;
}

.emergency-contact p {
    margin-top: 10px;
}

.emergency-contact a {
    color: #b91c1c;
}

@media (max-width: 768px) {
    .card {
        padding: 16px;
    }

    .tabs {
        flex-direction: column;
    }

    .tab {
        padding: 8px 12px;
        border-bottom: 1px solid var(--gray-light);
    }

    .tab.active {
        border-bottom: 3px solid var(--primary);
        border-left: none;
    }

    .recommendations-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .priority-badge {
        margin-left: 0;
    }

    .resources-grid {
        grid-template-columns: 1fr;
    }

    .history-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .slider-container {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .slider-value {
        text-align: center;
    }

    .actions {
        flex-direction: column;
    }

    .actions .btn {
        width: 100%;
    }
}