/* Basic reset and global styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #111827; /* gray-900 */
    color: #f3f4f6; /* gray-100 */
    min-height: 100%;
    line-height: 1.5;
}

.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1152px; /* max-w-7xl */
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem; /* px-6 */
    padding-right: 1.5rem; /* px-6 */
}

.red-text {
    color: #e53e3e; /* red-600 */
}

/* Header */
.header {
    background-color: #0c101a; /* gray-950 */
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(229, 62, 62, 0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/*clickable home button*/
.logo-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: opacity 0.2s;
}

.logo-link:hover {
    opacity: 0.9;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.logo p {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* Nav Bar*/
.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: #d1d5db;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.2s;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
}

.nav-link:hover {
    color: #ffffff;
    background-color: #1f2937;
}

.nav-link.active {
    color: #ef4444;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.welcome-section {
    text-align: center;
    margin-top: 4rem;
}

.welcome-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.welcome-text {
    font-size: 1.25rem;
    color: #9ca3af;
    max-width: 600px;
    margin: 0 auto;
}

/* --- CALCULATOR STYLES --- */
.calc-container {
    background-color: #1f2937;
    border-radius: 0.5rem;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: #d1d5db;
}

.driver-select {
    width: 100%;
    padding: 0.75rem;
    background-color: #374151;
    border: 1px solid #4b5563;
    color: white;
    border-radius: 0.375rem;
    font-size: 1rem;
}

.calc-btn {
    background-color: #e53e3e; /* Red */
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}

.calc-btn:hover {
    background-color: #c53030;
}

/* Loading Animation */
.calculating-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fbbf24; /* Amber */
    text-align: center;
    margin-top: 2rem;
    animation: pulse 1.5s infinite;
    display: none; /* Hidden by default */
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Results Section */
.result-box {
    margin-top: 2rem;
    background-color: #111827;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid #374151;
    display: none; /* Hidden by default */
}

.result-message {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}

.success-msg { color: #34d399; } /* Green */
.fail-msg { color: #9ca3af; font-style: italic; } /* Gray/Italic */

.scenario-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.scenario-table th, .scenario-table td {
    padding: 0.75rem;
    text-align: center;
    border-bottom: 1px solid #374151;
}

.scenario-table th {
    color: #9ca3af;
    font-weight: 600;
    text-transform: uppercase;
}

.scenario-table td {
    color: #f3f4f6;
}

.highlight-row {
    background-color: rgba(229, 62, 62, 0.1); /* Slight red tint for selected driver */
}

/* Driver Grid */
.driver-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 2rem;
}

/* Responsive grid */
@media (min-width: 768px) {
    .driver-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (min-width: 1024px) {
    .driver-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.loading-text {
    color: #9ca3af;
    text-align: center;
    grid-column: 1 / -1;
}

/* --------Driver Card-------- */
.driver-card {
    background-color: #1f2937;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.driver-card:hover {
    transform: scale(1.05);
    box-shadow: 0 20px 25px -5px rgba(229, 62, 62, 0.2);
}

.card-team-color-bar {
    height: 0.5rem;
}

.card-content {
    padding: 3rem;
    text-align: center;
}

.card-image {
    width: 8rem;
    height: 8rem;
    border-radius: 9999px;
    border: 4px solid #374151;
    object-fit: cover;
    margin-left: auto;
    margin-right: auto;
}

.card-name {
    margin-top: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.card-team {
    margin-top: 0.25rem;
    font-weight: 600;
}

.card-country {
    margin-top: 0.1rem;
    font-size: 0.875rem;
    color: #9ca3af;
}

.card-bio {
    margin-top: 1.25rem;
    font-size: 0.875rem;
    color: #d1d5db;
}

/* Footer */
.footer {
    background-color: #0c101a;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    margin-top: 3rem;
    color: #6b7280;
    text-align: center;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
    z-index: 1000;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: #1f2937;
    border-radius: 0.5rem;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    position: relative;
    transform: scale(0.9);
    transition: all 0.3s ease-in-out;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-overlay.open .modal-content {
    transform: scale(1);
}

.modal-close-btn {
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 2.5rem;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
}

.modal-close-btn:hover {
    color: #f3f4f6;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #374151;
}

.modal-image {
    width: 5rem;
    height: 5rem;
    border-radius: 9999px;
    border: 3px solid #4b5563;
    object-fit: cover;
}

.modal-header-text h2 {
    font-size: 1.875rem;
    font-weight: 700;
}

.modal-header-text p {
    font-size: 1.125rem;
    font-weight: 500;
}

.modal-body {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 0.875rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-size: 1.125rem;
    color: #f3f4f6;
    font-weight: 600;
}

/* --- search & team grouping --- */
.search-container {
    max-width: 600px;
    margin: 0 auto 3rem auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    background-color: #1f2937;
    border: 2px solid #374151;
    border-radius: 9999px;
    color: #f3f4f6;
    font-size: 1.125rem;
    outline: none;
    transition: all 0.2s;
}

.search-input:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.team-section {
    margin-bottom: 4rem;
}

.team-header {
    margin-bottom: 1.5rem;
}

.team-title {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.team-divider {
    height: 4px;
    width: 100%;
    border-radius: 2px;
    opacity: 0.8;
}