/* =========================================
   RaceFlow Common Styles (style.css)
   ========================================= */

/* --- Base & Typography --- */
body {
    font-family: sans-serif;
    background-color: #EDF0FF;
    margin: 0;
    padding: 0;
    color: navy;
    background-image: url("img/dblogin-background.png");
    background-size: 100% 7em;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#message-board {
    text-align: center;
    font-style: italic;
    color: #7f8c8d;
    margin-bottom: 1em;
}

/* --- Layout & Containers --- */
.main-header-wrapper {
    position: sticky;
    top: 0;
    z-index: 900;
    background-color: #fff;
    box-shadow: 0 0.2em 0.6em rgba(0, 0, 0, 0.08);
    padding: 1em 2em;
    margin-bottom: 2em;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 160ch;
    margin: 0 auto;
}

.main-header h1 {
    margin: 0;
    color: #2c3e50;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.8em;
}

.dashboard-layout {
    /*max-width: 160ch;*/
    margin: 0 auto;
    padding: 0 2em 2em 2em;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- Accordion Sections --- */
.section-container {
    background: #fff;
    padding: 2em;
    border-radius: 0.8em;
    box-shadow: 0 0.4em 0.6em rgba(0, 0, 0, 0.05);
    margin-bottom: 2em;
    min-width: 700px;
    width: -moz-available;
    width: -webkit-fill-available;
    width: stretch;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 0.1em solid #ecf0f1;
    padding-bottom: 0.5em;
}

.toggle-header {
    cursor: pointer;
    user-select: none;
}

.toggle-header:hover h2 {
    color: #3498db;
}

.section-header h2 {
    margin: 0;
    color: #2c3e50;
    transition: color 0.2s;
}

.chevron {
    font-size: 1.2em;
    color: #7f8c8d;
    transition: transform 0.2s ease-in-out;
    display: inline-block;
}

.expanded .chevron {
    transform: rotate(90deg);
}

.section-content {
    padding-top: 1.5em;
}

/* --- Forms & Inputs --- */
.form-group {
    margin-bottom: 1.5em;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.form-group label {
    font-weight: bold;
    margin-bottom: 0.5em;
    color: #34495e;
}

.form-group input,
.form-group select {
    padding: 0.8em 1ch;
    font-size: 1em;
    border: 0.1em solid #bdc3c7;
    border-radius: 0.4em;
    background-color: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #3498db;
}

/* --- Tables --- */
.table-container {
    overflow-y: auto;
    border: 0.1em solid #ecf0f1;
    border-radius: 0.4em;
    background: #fff;
    max-height: 600px;
}

.fleet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    min-width: 100ch;
}

.fleet-table a:not(.action-btn) {
    color: #3498db;
    text-decoration: none;
    font-weight: bold;
}

.fleet-table a:not(.action-btn):hover {
    color: #2980b9;
    text-decoration: underline;
}


.fleet-table th,
.fleet-table td {
    border-bottom: 0.1em solid #ecf0f1;
    padding: 0.6em 1ch;
    text-align: left;
}

.fleet-table th {
    background-color: #f8f9fa;
    color: #2c3e50;
    position: sticky;
    top: 0;
    z-index: 1;
    box-shadow: inset 0 -0.1em 0 #ecf0f1;
}

.fleet-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.fleet-table th.sortable:hover {
    background-color: #e0e6ed;
}

.fleet-table tr:hover {
    background-color: #eaf1f8;
}

/*
.fleet-table tbody tr:nth-child(even) {
    background-color: #fafbfc;
}
*/

/* --- Buttons --- */
.action-btn {
    padding: 0.5em 1.5ch;
    font-size: 0.9em;
    border: none;
    border-radius: 0.4em;
    cursor: pointer;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s, opacity 0.2s;
}

.btn-primary {
    background-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #8e44ad;
}

.btn-secondary:hover {
    background-color: #732d91;
}

.btn-secondary:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-save {
    background-color: #2ecc71;
    font-size: 1.1em;
    padding: 0.8em 2ch;
}

.btn-save:hover {
    background-color: #27ae60;
}

.btn-save:disabled,
.btn-primary:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-select {
    background-color: #2ecc71;
    padding: 0.4em 1ch;
    font-size: 0.85em;
}

.btn-select:hover {
    background-color: #27ae60;
}

.btn-remove {
    background-color: #d98880;
}

.btn-remove:hover {
    background-color: #c0392b;
}

/* --- Modals --- */
.modal-overlay {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000;
}

.modal-content {
    background-color: #f4f7fa;
    margin: 15vh auto;
    padding: 1.5em;
    border-radius: 0.8em;
    width: 90%;
    max-width: 60ch;
}

.flag-icon {
    width: 1.8em;
    height: 1.2em;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 0.5ch;
    border: 0.05em solid #ccc;
    border-radius: 0.2em;
}

.error-msg {
    color: #e74c3c;
    font-size: 0.85em;
    margin-top: 0.5em;
    display: none;
}

.map-controls {
    margin-bottom: 1em;
    padding: 0.8em;
    background: #f8f9fa;
    border-radius: 0.4em;
    border: 1px solid #ecf0f1;
}

.map-controls label {
    cursor: pointer;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 1ch;
    margin-right: 2ch;
}