:root {
    --primary-color: #0d274d; /* Dark Blue */
    --secondary-color: #f2c14e; /* Yellow/Gold */
    --background-color: #f0f2f5;
    --text-color: #333;
    --card-bg-color: #ffffff;
    --border-color: #dee2e6;
    --success-color: #28a745;
    --error-color: #dc3545;
    --font-family: 'Roboto', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
}

#app-container {
    width: 100%;
    max-width: 1400px; /* Center content for better web view */
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
}

header {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin: 1rem -1rem; /* Extend to edges of the container's padding */
    border-radius: 8px;
}

.logo {
    height: 40px;
}

header h1 {
    font-weight: 500;
    font-size: 1.75rem;
    margin: 0;
}

main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 1rem 0;
}

.card {
    background-color: var(--card-bg-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.card h2 {
    color: var(--primary-color);
    margin-top: 0;
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .input-grid {
        grid-template-columns: 1fr;
    }
    header {
        flex-direction: column;
        text-align: center;
    }
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.input-group input[type="text"] {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 39, 77, 0.1);
}

.file-drop-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100px;
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    background-color: #fafafa;
    transition: border-color 0.2s, background-color 0.2s;
    cursor: pointer;
    padding: 1rem;
    box-sizing: border-box;
}

.file-drop-area.dragover {
    border-color: var(--primary-color);
    background-color: #f0f5fa;
}

.file-drop-area .file-msg {
    color: #888;
    text-align: center;
}

.file-drop-area input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.file-name-display {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #555;
    word-break: break-all;
    font-style: italic;
}

button#validate-btn {
    background: linear-gradient(145deg, var(--secondary-color), #ffb300);
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    padding: 14px 28px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    width: 100%;
    max-width: 300px;
    display: block;
    margin: 1.5rem auto 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

button#validate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

button#validate-btn:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
}

#download-pdf-btn {
    background: var(--primary-color);
    color: white;
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid var(--primary-color);
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: block;
    margin: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#download-pdf-btn:hover:not(:disabled) {
    background: #0b2141;
    transform: translateY(-1px);
}

#download-pdf-btn.hidden {
    display: none;
}


#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1rem;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 500;
}

.spinner {
    border: 5px solid rgba(13, 39, 77, 0.2);
    border-top: 5px solid var(--secondary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#results-container .table-container {
    overflow-x: auto;
}

.results-category h3 {
    color: var(--primary-color);
    margin-top: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    font-size: 1.25rem;
}

.results-category:first-of-type h3 {
    margin-top: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

th, td {
    border: 1px solid var(--border-color);
    padding: 12px 15px;
    text-align: left;
    vertical-align: middle;
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
}

tr:nth-child(even) {
    background-color: #f8f9fa;
}

.status-pass, .status-fail, .status-info {
    font-weight: bold;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
}

.status-pass::before, .status-fail::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.status-pass {
    color: var(--success-color);
}
.status-pass::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2328a745'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z'/%3E%3C/svg%3E");
}

.status-fail {
    color: var(--error-color);
}
.status-fail::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23dc3545'%3E%3Cpath d='M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z'/%3E%3C/svg%3E");
}

.status-info {
    color: var(--primary-color);
}

.status-banner {
    padding: 1rem;
    border-radius: 4px;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.status-banner.PASS {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-banner.FAIL {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

#confidence-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    text-align: center;
}

#confidence-section h4 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 500;
}

#confidence-score-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

#confidence-reasoning {
    margin: 0.5rem 0 0 0;
    font-style: italic;
    color: #555;
    font-size: 0.9rem;
}

#highlighted-mtr-container {
    margin-top: 2rem;
}

#highlighted-mtr-container h3 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.canvas-wrapper {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    line-height: 0; /* remove bottom space */
}

#mtr-canvas {
    width: 100%;
    height: auto;
    border-radius: 4px;
}


.error-text {
    color: var(--error-color);
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

.hidden {
    display: none !important;
}

footer {
    text-align: center;
    padding: 2rem;
    color: #888;
    font-size: 0.9rem;
    background-color: var(--background-color);
}
