/* General Body and Layout */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #121212;
    color: #e0e0e0;
    margin: 0;
    padding: 0; /* Remove default padding */
}

/* Header and Navigation */
header {
    background-color: #1e1e1e;
    padding: 0 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
    margin-bottom: 2rem;
}

nav {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

nav a {
    color: #e0e0e0;
    text-decoration: none;
    padding: 1rem;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
    border-bottom: 2px solid transparent;
}

nav a:hover {
    color: #ffffff;
    background-color: #2a2a2a;
}

nav a.active {
    color: #3771e0;
    border-bottom-color: #3771e0;
}

/* Main Content Container */
main {
    display: flex;
    justify-content: center;
    padding: 0 20px 20px 20px;
}

.container {
    width: 100%;
    max-width: 900px; /* Increased max-width for better spacing */
    background-color: transparent; /* Container is now for layout, not background */
    padding: 0; /* Remove padding from container */
    box-shadow: none; /* Remove shadow from container */
    display: flex;
    flex-direction: column;
    gap: 2rem; /* Add gap between cards */
}

.container.wide {
    max-width: 1200px;
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

/* Card styling for sections */
.card {
    background-color: #1e1e1e;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.metric-card {
    background-color: #2a2a2a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1rem;
}

.metric-label {
    color: #a8a8a8;
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.metric-card strong {
    color: #ffffff;
    font-size: 1.25rem;
}

.muted {
    color: #a8a8a8;
}

.alert-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.status-ok,
.status-warning {
    border-radius: 999px;
    display: inline-block;
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
}

.status-ok {
    background-color: rgba(46, 160, 67, 0.16);
    color: #57d364;
}

.status-warning {
    background-color: rgba(255, 193, 7, 0.14);
    color: #ffd166;
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recommendation-card {
    background-color: #2a2a2a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1rem;
}

.recommendation-header,
.recommendation-body {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.recommendation-body {
    color: #c7c7c7;
    margin-top: 0.5rem;
}

.reason-codes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.reason-codes span {
    background-color: rgba(55, 113, 224, 0.16);
    border-radius: 999px;
    color: #8bb3ff;
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
}

.placeholder {
    color: #a8a8a8;
    text-align: center;
}

h1, h2, h3 {
    color: #ffffff;
    margin-top: 0;
}

h2 {
    border-bottom: 1px solid #333;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

.muted {
    color: #a8a8a8;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.metric-card {
    background-color: #2a2a2a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1rem;
}

.metric-card span {
    display: block;
    color: #a8a8a8;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.metric-card strong {
    display: block;
    font-size: 1.35rem;
}

.positive {
    color: #4caf50;
}

.negative {
    color: #ff5252;
}

/* Form and Button Styling */
#upload-form, .alias-form, .inline-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

input[type="file"], input[type="text"], input[type="number"] {
    border: 1px solid #444;
    padding: 0.75rem; /* Increased padding */
    border-radius: 4px;
    background-color: #2a2a2a;
    color: #e0e0e0;
    font-size: 1rem;
}

button, .button { /* General button class */
    padding: 0.75rem;
    background-color: #3771e0;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.small-button {
    padding: 0.35rem 0.6rem;
    margin-right: 0.35rem;
    font-size: 0.8rem;
}

button:hover, .button:hover {
    background-color: #2858b0;
}

.button-danger {
    padding: 0.5rem 1rem;
    background-color: #c9302c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.button-danger:hover {
    background-color: #a52825;
}

button:disabled, .button:disabled, .button-danger:disabled {
    background-color: #555;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Table Styling */
.table-container {
    overflow-x: auto; /* For responsiveness on small screens */
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

table th, table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #333;
    white-space: nowrap;
}

table th {
    background-color: #2a2a2a;
    font-weight: 600;
}

table tbody tr:last-child td {
    border-bottom: none;
}

table tbody tr:hover {
    background-color: #2c2c2c;
}

/* Pagination Styling */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
}

.pagination-controls button {
    padding: 0.5rem 1rem;
}

/* Alias List Styling */
.alias-list {
    list-style-type: none;
    padding: 0;
    margin-top: 1.5rem;
}

.alias-list li {
    background-color: #2a2a2a;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* Chart and Loader */
.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3771e0;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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

.error-message {
    color: #ff5252;
    background-color: rgba(255, 82, 82, 0.1);
    border: 1px solid #ff5252;
    padding: 1rem;
    border-radius: 4px;
    text-align: center;
    margin-bottom: 1rem;
}

.success-message {
    color: #4caf50;
    background-color: rgba(76, 175, 80, 0.1);
    border: 1px solid #4caf50;
    padding: 1rem;
    border-radius: 4px;
    text-align: center;
    margin-bottom: 1rem;
}

.empty-state {
    color: #a8a8a8;
    text-align: center;
    padding: 2rem;
    background-color: #2a2a2a;
    border-radius: 8px;
}
