/* Medical Mileage Tracker Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4472C4;
    --secondary-color: #70AD47;
    --danger-color: #C55A11;
    --light-bg: #F2F2F2;
    --dark-text: #333333;
    --border-color: #D9E1F2;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: #fafafa;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand h1 {
    font-size: 1.5rem;
}

.navbar-brand a {
    color: white;
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.3s;
}

.nav-link:hover {
    opacity: 0.8;
}

/* Main Content */
main {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

/* Dashboard */
.dashboard h2 {
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.persons-section h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

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

.person-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s;
}

.person-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.person-card h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.person-stats {
    margin: 1rem 0;
}

.person-stats p {
    margin: 0.5rem 0;
    color: #666;
}

.person-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Person Detail */
.person-detail h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.person-controls {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: white;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.privacy-toggle {
    display: flex;
    align-items: center;
}

.privacy-toggle label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--dark-text);
    margin: 0;
}

.privacy-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.filters-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: white;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.filters-section label {
    font-weight: 600;
    color: var(--dark-text);
}

.year-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
    min-width: 150px;
}

.year-select:hover {
    border-color: var(--primary-color);
}

.year-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(68, 114, 196, 0.1);
}

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

.card {
    background: white;
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card h4 {
    color: #666;
    font-size: 0.9rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.large-number {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: bold;
}

/* Actions */
.actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #3860A3;
}

.btn-secondary {
    background-color: #999;
    color: white;
}

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

.btn-success {
    background-color: var(--secondary-color);
    color: white;
}

.btn-success:hover {
    background-color: #5a8d38;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #A24709;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Tables */
.trips-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.trips-table thead {
    background-color: var(--primary-color);
    color: white;
}

.trips-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.trips-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.trips-table tbody tr:hover {
    background-color: var(--light-bg);
}

.trips-table .address {
    font-size: 0.9rem;
    max-width: 200px;
}

.trips-table .address strong {
    font-size: 1rem;
    font-weight: 600;
}

.trips-table .address small {
    font-size: 0.75rem;
    color: #666;
}

.trips-table .number {
    text-align: right;
    font-family: monospace;
}

.trips-table .center {
    text-align: center;
}

.trips-table .actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.badge-deductible {
    background-color: #d4edda;
    color: #155724;
}

.badge-non-deductible {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-manual {
    background-color: #cce5ff;
    color: #004085;
}

.badge-imported {
    background-color: #e2e3e5;
    color: #383d41;
}

/* Non-deductible row styling */
.trips-table tbody tr.non-deductible {
    opacity: 0.75;
    background-color: #fff8f8;
}

.trips-table tbody tr.non-deductible:hover {
    background-color: #ffe8e8;
}

/* Modal */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    justify-content: center;
    align-items: flex-start;
    padding-top: 5%;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: black;
}

.modal-content h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-content input[type="text"],
.modal-content input[type="file"],
.modal-content input[type="email"],
.modal-content input[type="date"],
.modal-content input[type="number"],
.modal-content textarea {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.modal-content textarea {
    resize: vertical;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--dark-text);
}

.form-group.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.form-group.checkbox label {
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.form-group.checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Messages */
.status-message {
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 4px;
    background-color: #DFF0D8;
    color: #3C763D;
    border: 1px solid #D6E9C6;
}

.status-message.hidden {
    display: none;
}

/* Mileage Rate Section */
.rate-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: #f0f8ff;
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
}

.rate-section h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.rate-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background-color: white;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.rate-display {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.rate-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

.rate-label {
    font-size: 1rem;
    color: #666;
}

#refreshRateBtn {
    white-space: nowrap;
}

#rateStatus {
    margin-top: 0.5rem;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.no-data {
    padding: 2rem;
    text-align: center;
    color: #999;
    background-color: var(--light-bg);
    border-radius: 4px;
}

/* Audit Log Section */
.audit-section {
    margin-top: 3rem;
    padding: 1.5rem;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.audit-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.audit-controls {
    margin-bottom: 1.5rem;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.audit-table thead {
    background-color: #f5f5f5;
    border-bottom: 2px solid var(--border-color);
}

.audit-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--dark-text);
}

.audit-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.audit-table tbody tr:hover {
    background-color: var(--light-bg);
}

.audit-action {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.audit-create {
    background-color: #d4edda;
    color: #155724;
}

.audit-update {
    background-color: #cce5ff;
    color: #004085;
}

.audit-delete {
    background-color: #f8d7da;
    color: #721c24;
}

.audit-import {
    background-color: #fff3cd;
    color: #856404;
}

.audit-export {
    background-color: #d1ecf1;
    color: #0c5460;
}

.hidden {
    display: none !important;
}

/* Import History Section */
.import-history-section {
    margin-top: 3rem;
    padding: 1.5rem;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.import-history-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.import-controls {
    margin-bottom: 1.5rem;
}

.import-history-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.import-history-table thead {
    background-color: #f5f5f5;
    border-bottom: 2px solid var(--border-color);
}

.import-history-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--dark-text);
}

.import-history-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.import-history-table tbody tr:hover {
    background-color: var(--light-bg);
}

/* Batch Controls */
.batch-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 4px;
    flex-wrap: wrap;
}

.batch-controls p {
    margin: 0;
    font-weight: 600;
    color: #1565c0;
}

/* Advanced Statistics Section */
.statistics-section {
    margin-top: 3rem;
    padding: 1.5rem;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.statistics-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.statistics-controls {
    margin-bottom: 1.5rem;
}

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

.stat-card {
    background-color: white;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card h4 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.stat-card p {
    margin: 0.75rem 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Footer */
footer {
    background-color: #f5f5f5;
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 2rem;
    text-align: center;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar-menu {
        gap: 1rem;
        font-size: 0.9rem;
    }
    
    .persons-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .trips-table {
        font-size: 0.85rem;
    }
    
    .trips-table th,
    .trips-table td {
        padding: 0.5rem;
    }
    
    .modal-content {
        width: 95%;
        max-width: 100%;
        padding: 1.5rem;
    }
}
