/* --- Dark Theme & Base Styles --- */
html {
  color-scheme: dark;
}
body {
  background-color: #0e1117;
  color: #fafafa;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}
/* UNIFIED FORM STYLES */
input, select, textarea, button, a.button {
  background-color: #262730 !important; /* Lighter background for all form fields */
  border: 1px solid #30363d !important; /* Subtle border */
  color: #fafafa !important;
  padding: 0.75rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  box-sizing: border-box;
  transition: all 0.2s ease-in-out;
}
textarea {
    min-height: 170px;
}
button, a.button {
  cursor: pointer;
  background-color: #ff4b4b !important;
  border-color: #ff4b4b !important;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}
button:hover, a.button:hover {
    filter: brightness(1.15);
}
hr {
  border-color: rgba(255, 255, 255, 0.2);
}
select option {
    background-color: #262730;
    color: #fafafa;
}
/* --- BUTTON COLOR VARIATIONS --- */
.button.button-export,
.button.button-confirm,
.trip-actions .button.edit {
    background-color: #04aa6d !important;
    border-color: #04aa6d !important;
}
.button.button-secondary {
    background-color: #262730 !important;
    border-color: #444 !important;
    font-weight: 500 !important;
}
.button.button-secondary:hover {
    border-color: #666 !important;
    filter: brightness(1.1);
}


/* --- General App Layout --- */
.block-container { 
    max-width: 850px; 
    padding: 1rem 1rem 0.5rem 1rem;
    margin: 0 auto; 
}
.custom-title-block { 
    text-align: center; 
    /* FIX: Significantly reduced bottom margin to tighten the header */
    margin-bottom: 0.5rem;
}
.custom-title-block h1 { 
    font-size: 2.5rem; 
    font-weight: 600; 
    margin-top: 0;
    /* FIX: Reduced bottom margin on the H1 itself */
    margin-bottom: 0.1rem;
}
.custom-title-block p { 
    font-size: 1rem; 
    color: #999; 
    line-height: .9; 
    margin-top: 0;
    margin-bottom: 0;
}
h2 {
    font-weight: 600;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}
h5 { 
    margin-top: 2rem;
    margin-bottom: 1rem; 
    font-size: 1.1rem;
    border-bottom: 1px solid #30363d;
    padding-bottom: 0.5rem;
}
.message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
}
.message.success {
    background-color: rgba(4, 170, 109, 0.2);
    color: #04aa6d;
}
.message.error {
    background-color: rgba(255, 75, 75, 0.1);
    color: #ff4b4b;
}

/* --- Main Tabs --- */
.tabs {
    display: flex;
    border-bottom: 1px solid #30363d;
    margin-bottom: 1.5rem;
}
.tab-link {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: #7d8590;
    text-decoration: none;
    margin-bottom: -1px; /* Align with border */
}
.tab-link.active {
    color: #fafafa;
    border-bottom-color: #ff4b4b;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* FIX: Added a media query for mobile responsiveness.
  On screens 600px or less, this will reduce padding and font size
  to prevent the navigation bar from wrapping.
*/
@media (max-width: 600px) {
    .tab-link {
        padding: 0.75rem 0.5rem; /* Reduced horizontal padding */
        font-size: 0.9rem;      /* Slightly smaller font */
    }
}

/* --- Forms --- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem 1rem;
}
.form-group {
    display: flex;
    flex-direction: column;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
}
.full-width {
    grid-column: 1 / -1;
}
/* CORRECTED PASSWORD TOGGLE STYLES */
.password-wrapper {
    position: relative;
    display: flex; /* This helps align items inside */
    width: 100%;
}
.password-wrapper input {
    padding-right: 40px; /* Make space for the icon */
}
.password-wrapper .toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    user-select: none;
    color: #7d8590;
}


/* --- Trip Records --- */
.trip-item-container { 
    padding-bottom: 1rem; 
    margin-bottom: 1rem; 
    border-bottom: 1px solid #30363d;
}
.trip-item-container:last-child {
    border-bottom: none;
}
.trip-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.trip-date-header { 
    font-weight: bold; 
    font-size: 1rem; 
}
.trip-item-body {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 1rem;
    align-items: flex-start;
}
.trip-data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
}
.trip-data-item { 
    background-color: #262730; 
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
}
.trip-data-label { 
    font-size: 0.75rem; 
    display: block;
    color: #b0b0b0; 
} 
.trip-data-value { 
    font-size: 0.9rem; 
    font-weight: 500; 
    display: block; 
    color: #e8e8e8; 
} 
.trip-list-note-item { 
    color: #999; 
    font-size: 0.8rem; 
    margin-top: 0.5rem;
    white-space: pre-wrap; 
}
.trip-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.trip-actions .button {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.8rem;
}
.trip-actions .button.delete {
    background-color: #30363d;
    border-color: #30363d;
}
.status-symbol { 
    font-weight: bold; 
    font-size: 1rem; 
}
.status-complete { color: #04aa6d; } 
.status-incomplete { color: #ffc107; }
.pagination-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
}

/* --- Analytics Page --- */
.analytics-section-title {
    margin-top: 1.5rem;
    margin-bottom: 1rem; 
    font-size: 1.1rem;
    font-weight: 600;
}
.date-filter-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
}
.date-filter-form input {
    max-width: 180px;
}
.summary-data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.chart-section-container {
    margin-top: 2rem;
}
.chart-tabs {
    display: flex;
    border-bottom: 1px solid #30363d;
}
.chart-tab-link {
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: #7d8590;
    text-decoration: none;
}
.chart-tab-link.active {
    color: #fafafa;
    border-bottom: 2px solid #ff4b4b;
    margin-bottom: -1px;
}
.chart-container {
    position: relative;
    height: 40vh;
    width: 100%;
    max-width: 800px;
    margin-top: 1rem;
}

/* --- Manage Data Page --- */
.manage-data-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: flex-start;
}
@media (min-width: 768px) {
    .manage-data-grid {
        grid-template-columns: 1fr 1fr;
    }
}
.manage-data-section p {
    color: #999;
    font-size: 0.9rem;
}
.radio-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    cursor: pointer;
}
.radio-group input[type="radio"] {
    display: none;
}
.radio-group input[type="radio"] + span {
    display: inline-block;
    position: relative;
    padding-left: 30px;
    line-height: 20px;
}
.radio-group input[type="radio"] + span:before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid #555;
    border-radius: 50%;
    background: #222;
    box-sizing: border-box;
}
.radio-group input[type="radio"]:checked + span:after {
    content: '';
    position: absolute;
    left: 10px; /* Center of the 20px circle */
    top: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff4b4b;
}


/* --- Footer --- */
.app-status-bar { 
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0; 
    margin-top: 2rem; 
    border-top: 1px solid #30363d;
}
.footer-buttons {
    display: flex;
    gap: 0.5rem;
}



/* v11: Notes aligned under left column, buttons centered, prev/next grey */
.trip-item-body { display: grid; grid-template-columns: 3fr 1fr; gap: 1rem; align-items: flex-start; }
.trip-item-body > .trip-list-note-item {
  grid-column: 1 / 2 !important;
  margin: .5rem 0 0 0 !important;
  padding: 0 !important;
  text-align: left !important;
}
.trip-actions .button{ text-align: center; }
.pagination-nav .button{ text-align: center; }
