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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
}

.section {
    padding: 40px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.15s ease;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

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

.form-group input:disabled,
.form-group select:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-row.three-cols {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-section {
    margin-bottom: 40px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 12px;
}

.form-section h4 {
    margin-bottom: 20px;
    color: #667eea;
    font-size: 1.3rem;
}

/* Dynamic Entry Cards */
.entry-card {
    background: white;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    position: relative;
}

.entry-card .remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.entry-card .remove-btn:hover {
    background: #cc0000;
}

/* Compact Form Layout */
.compact-form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group.compact {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

.form-group.compact.full-width {
    flex: 1 1 100%;
}

.form-group.compact label {
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.form-group.compact input,
.form-group.compact select {
    padding: 8px;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Active/Pressed button states */
.btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-primary:active {
    background: linear-gradient(135deg, #5568d3 0%, #6a3d8f 100%);
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary:active {
    background: #545b62;
    transform: translateY(0) scale(0.98);
}

.btn-small:active {
    transform: scale(0.95);
}

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

.btn-secondary:hover {
    background: #5a6268;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Dashboard */
.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.dashboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.dash-tab-btn {
    padding: 12px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.15s ease;
}

.dash-tab-btn:hover {
    color: #667eea;
}

.dash-tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.dash-content {
    display: none;
}

.dash-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

/* JSON Display */
.json-container {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    max-height: 500px;
    overflow: auto;
    margin-top: 20px;
}

.json-container pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.help-text {
    color: #666;
    font-style: italic;
}

.data-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Footer */
footer {
    background: #2d3748;
    color: white;
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
}

/* Messages */
.message {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    animation: slideIn 0.3s;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Admin Panel Styles */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 0 0 25px 0;
}

.stat-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #4a5568;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 0;
}

.admin-search {
    margin-bottom: 20px;
}

.admin-search input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.users-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.users-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.users-table tr:hover {
    background: #f8f9fa;
}

.user-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.user-status.active {
    background: #d4edda;
    color: #155724;
}

.user-status.inactive {
    background: #f8d7da;
    color: #721c24;
}

.admin-actions {
    display: flex;
    gap: 8px;
}

.admin-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.admin-btn.edit {
    background: #667eea;
    color: white;
}

.admin-btn.delete {
    background: #dc3545;
    color: white;
}

.admin-btn.view {
    background: #28a745;
    color: white;
}

.admin-btn.deactivate {
    background: #ffc107;
    color: #000;
}

.admin-btn.activate {
    background: #17a2b8;
    color: white;
}

.admin-btn:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

/* Deactivated user row styling */
.user-deactivated {
    opacity: 0.6;
    background: #f8f9fa;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: slideDown 0.3s;
}

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

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

.close:hover,
.close:focus {
    color: #000;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.subtitle {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* ========================== CALENDAR STYLES ========================== */

/* Calendar Controls */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-controls button {
    padding: 8px 16px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 0.9rem;
    font-weight: 600;
}

.calendar-controls button:active {
    background: #4c5bc4;
    transform: scale(0.95);
}

.calendar-controls button:hover {
    background: #5568d3;
}

.calendar-month-year {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

/* Calendar Grid */
.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin: 15px 0;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.calendar-day-name {
    padding: 10px;
    background: #667eea;
    color: white;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.calendar-day {
    aspect-ratio: 1;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    position: relative;
}

.calendar-day:hover {
    border-color: #667eea;
    background: #f0f0ff;
    transform: translateY(-2px);
}

.calendar-day.other-month {
    color: #ccc;
    background: #f9f9f9;
    cursor: default;
}

.calendar-day.other-month:hover {
    transform: none;
    border-color: #e0e0e0;
    background: #f9f9f9;
}

.calendar-day.today {
    border-color: #667eea;
    background: #f0f0ff;
    font-weight: bold;
}

.calendar-day.has-events {
    background: #d4edda;
    border-color: #28a745;
    font-weight: 600;
}

.calendar-day.has-events:hover {
    background: #c3e6cb;
}

.calendar-day.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transform: scale(1.05);
}

.calendar-day-number {
    font-size: 1rem;
    font-weight: 600;
}

.calendar-day-dots {
    font-size: 1.2rem;
    color: #28a745;
    margin-top: 2px;
}

/* Event List in Modal */
.event-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.event-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.event-item-header strong {
    color: #667eea;
    font-size: 1rem;
}

.event-item-actions {
    display: flex;
    gap: 6px;
}

.event-item-details {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

/* ========================== SCHEDULE SUMMARY STYLES ========================== */

.schedule-summary-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.schedule-day-group {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.15s ease;
}

.schedule-day-group:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.schedule-day-header {
    font-weight: 600;
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

.schedule-entry {
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}

.schedule-entry:last-child {
    border-bottom: none;
}

.schedule-direction {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 5px;
}

.schedule-detail-line {
    font-size: 0.9rem;
    color: #666;
    margin: 3px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.schedule-detail-line strong {
    min-width: 100px;
    color: #333;
}

.seats-available {
    color: #28a745;
    font-weight: 600;
}

.seats-needed {
    color: #dc3545;
    font-weight: 600;
}

.schedule-time {
    color: #666;
    font-size: 0.85rem;
    font-style: italic;
}

.schedule-notes {
    color: #888;
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 5px;
    padding-left: 20px;
}

.schedule-empty-month {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.schedule-empty-month-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.schedule-summary-legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.schedule-summary-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========================== CARPOOL INVENTORY STYLES ========================== */

/* Carpool Filters */
.carpool-filters {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* Carpool Calendar */
.carpool-calendar-day {
    aspect-ratio: 1;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    position: relative;
}

.carpool-calendar-day:hover {
    border-color: #667eea;
    background: #f0f0ff;
    transform: translateY(-2px);
}

.carpool-calendar-day.has-available {
    background: #d4edda;
    border-color: #28a745;
}

.carpool-calendar-day.has-needed {
    background: #f8d7da;
    border-color: #dc3545;
}

.carpool-calendar-day.has-both {
    background: #fff3cd;
    border-color: #ffc107;
}

.carpool-calendar-day.other-month {
    color: #ccc;
    background: #f9f9f9;
    cursor: default;
}

.carpool-calendar-day.other-month:hover {
    transform: none;
    border-color: #e0e0e0;
    background: #f9f9f9;
}

.carpool-calendar-day.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transform: scale(1.05);
}

/* Carpool Cards */
.carpool-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.15s ease;
}

.carpool-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.carpool-card.available {
    border-left: 5px solid #28a745;
}

.carpool-card.needed {
    border-left: 5px solid #dc3545;
}

.carpool-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.carpool-card-title {
    flex: 1;
}

.carpool-card-date {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.carpool-card-route {
    font-size: 0.95rem;
    color: #667eea;
    font-weight: 500;
}

.carpool-card-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.carpool-card-badge.available {
    background: #d4edda;
    color: #155724;
}

.carpool-card-badge.needed {
    background: #f8d7da;
    color: #721c24;
}

.carpool-card-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.carpool-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #666;
}

.carpool-info-item strong {
    color: #333;
}

.carpool-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.carpool-family-name {
    font-weight: 600;
    color: #667eea;
}

.carpool-action-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.carpool-action-btn.primary {
    background: #667eea;
    color: white;
}

.carpool-action-btn.primary:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.carpool-action-btn:active {
    transform: translateY(0) scale(0.95);
    opacity: 0.9;
}

.carpool-action-btn.secondary {
    background: #6c757d;
    color: white;
}

.carpool-action-btn.secondary:hover {
    background: #5a6268;
}

/* Carpool Details in Modal */
.carpool-detail-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.carpool-detail-section h4 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.carpool-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.carpool-detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: white;
    border-radius: 6px;
}

.carpool-notes {
    background: #fff3cd;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #ffc107;
    margin-top: 10px;
}

/* Empty State for Carpools */
.carpool-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.carpool-empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

/* Loading State */
.carpool-loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Carpool Stats Summary */
.carpool-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.carpool-stat-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    text-align: center;
}

.carpool-stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

.carpool-stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
}

/* ========================== RESPONSIVE ========================== */

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-row.three-cols {
        grid-template-columns: 1fr;
    }
    
    .compact-form-row {
        flex-direction: column;
    }
    
    .form-group.compact {
        min-width: 100%;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .section {
        padding: 20px;
    }
    
    .tabs, .dashboard-tabs {
        flex-wrap: wrap;
    }
    
    .calendar {
        gap: 3px;
    }
    
    .calendar-day {
        padding: 4px;
        font-size: 0.85rem;
    }
    
    .calendar-day-name {
        padding: 6px;
        font-size: 0.75rem;
    }
    
    .calendar-month-year {
        font-size: 1rem;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .carpool-card-body {
        grid-template-columns: 1fr;
    }
    
    .carpool-filters .form-row {
        grid-template-columns: 1fr;
    }
    
    .carpool-stats {
        grid-template-columns: 1fr 1fr;
    }
}

/* ========================== CARPOOL MATCH STYLES ========================== */

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(300%); }
}

.match-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.match-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.match-card.excellent {
    border-left: 6px solid #28a745;
    background: linear-gradient(to right, rgba(40, 167, 69, 0.05), transparent);
}

.match-card.good {
    border-left: 6px solid #17a2b8;
    background: linear-gradient(to right, rgba(23, 162, 184, 0.05), transparent);
}

.match-card.fair {
    border-left: 6px solid #ffc107;
    background: linear-gradient(to right, rgba(255, 193, 7, 0.05), transparent);
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.match-title {
    flex: 1;
}

.match-route {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 10px 0;
}

.match-families {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1rem;
    color: #666;
}

.driver-family, .rider-family {
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    background: #f8f9fa;
}

.driver-family {
    color: #28a745;
    background: #d4edda;
}

.rider-family {
    color: #667eea;
    background: #e7f3ff;
}

.match-arrow {
    font-size: 1.2rem;
    color: #999;
}

.match-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 20px;
    border-radius: 12px;
    min-width: 80px;
    text-align: center;
}

.match-score.excellent {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

.match-score.good {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.2);
}

.match-score.fair {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
}

.score-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.score-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 4px;
    opacity: 0.9;
}

.match-details {
    margin-bottom: 20px;
}

.match-detail-row {
    margin-bottom: 12px;
}

.detail-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.95rem;
}

.detail-icon {
    font-size: 1.1rem;
    margin-top: 2px;
}

.detail-label {
    font-weight: 600;
    color: #495057;
    min-width: 60px;
}

.detail-value {
    color: #666;
    line-height: 1.5;
    flex: 1;
}

.match-recommendation {
    background: #e7f3ff;
    border-left: 3px solid #667eea;
    padding: 12px 15px;
    border-radius: 6px;
    margin: 15px 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #333;
}

.recommendation-icon {
    margin-right: 8px;
    font-size: 1.1rem;
}

.match-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.match-actions .btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.match-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.match-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.match-actions .btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.match-actions .btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.3);
}

/* Match participants styles */
.match-participants {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.participant-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

.participant-card h5 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1rem;
}

.participant-detail {
    font-size: 0.9rem;
    color: #666;
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.match-reasoning {
    background: #e7f3ff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.match-reasoning h5 {
    color: #0066cc;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.match-reasoning p {
    color: #333;
    line-height: 1.6;
    margin: 0;
}

.match-factors {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.factor-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.factor-label {
    font-size: 0.85rem;
    color: #666;
}

.factor-score {
    font-weight: 600;
    color: #667eea;
}

/* Responsive design for match cards */
@media (max-width: 768px) {
    .match-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .match-score {
        flex-direction: row;
        gap: 10px;
        width: 100%;
        justify-content: center;
    }
    
    .match-families {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .match-actions {
        flex-direction: column;
    }
    
    .match-participants {
        grid-template-columns: 1fr;
    }
    
    .score-number {
        font-size: 1.5rem;
    }
}

/* ========================== DEBUG MODE STYLES ========================== */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #9b59b6;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

/* ========================== SIDEBAR LAYOUT ========================== */

/* Main dashboard layout container */
.dashboard-layout {
    display: flex;
    gap: 0;
    min-height: 600px;
    max-height: calc(100vh - 200px);
    margin-top: 20px;
}

/* Left Sidebar */
.dashboard-sidebar {
    width: 240px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    padding: 20px 0;
    border-radius: 12px 0 0 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

/* Custom scrollbar for sidebar */
.dashboard-sidebar::-webkit-scrollbar {
    width: 6px;
}

.dashboard-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.dashboard-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.dashboard-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.dashboard-sidebar .dash-tab-btn {
    width: 100%;
    padding: 14px 20px;
    text-align: left;
    color: rgba(255, 255, 255, 0.85);
    border: none;
    border-left: 4px solid transparent;
    border-bottom: none;
    border-radius: 0;
    background: transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-sidebar .dash-tab-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: rgba(255, 255, 255, 0.6);
}

.dashboard-sidebar .dash-tab-btn.active {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border-left-color: white;
    font-weight: 600;
}

.tab-icon {
    font-size: 1.3rem;
    min-width: 24px;
    text-align: center;
}

.tab-label {
    font-size: 0.95rem;
}

/* Main content area */
.dashboard-main {
    flex: 1;
    padding: 20px 30px;
    background: #f8f9fa;
    border-radius: 0 12px 12px 0;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

/* Custom scrollbar for main content */
.dashboard-main::-webkit-scrollbar {
    width: 8px;
}

.dashboard-main::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 4px;
}

.dashboard-main::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.dashboard-main::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

/* Horizontal tabs in main area - HIDDEN (all tabs now in sidebar) */
.dashboard-tabs-horizontal {
    display: none;
}

/* Hide old dashboard-tabs */
.dashboard-tabs {
    display: none;
}

/* ========================== RESPONSIVE SIDEBAR LAYOUT ========================== */

@media (max-width: 968px) {
    .dashboard-layout {
        flex-direction: column;
        max-height: none;
    }
    
    .dashboard-sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        border-radius: 12px 12px 0 0;
        padding: 15px 10px;
        gap: 8px;
    }
    
    .dashboard-sidebar .dash-tab-btn {
        min-width: 130px;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 12px 14px;
        white-space: nowrap;
    }
    
    .dashboard-sidebar .dash-tab-btn.active {
        border-left: none;
        border-bottom-color: white;
    }
    
    .dashboard-main {
        border-radius: 0 0 12px 12px;
        max-height: calc(100vh - 200px);
    }
    
    .tab-icon {
        font-size: 1.1rem;
    }
    
    .tab-label {
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .section {
        padding: 20px 15px;
    }
    
    .user-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .user-header h2 {
        font-size: 1.3rem;
    }
    
    .dashboard-layout {
        margin-top: 10px;
    }
    
    .dashboard-sidebar {
        gap: 6px;
        padding: 12px 8px;
        border-radius: 8px 8px 0 0;
    }
    
    .dashboard-sidebar .dash-tab-btn {
        min-width: 110px;
        padding: 10px 12px;
        font-size: 0.8rem;
        flex-direction: row;
        gap: 8px;
        justify-content: center;
    }
    
    .tab-icon {
        font-size: 1rem;
        min-width: 20px;
    }
    
    .tab-label {
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .dashboard-main {
        padding: 20px 12px;
        max-height: calc(100vh - 200px);
        border-radius: 0 0 8px 8px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .tagline {
        font-size: 0.9rem;
    }
    
    .dashboard-sidebar {
        padding: 10px 6px;
        gap: 5px;
    }
    
    .dashboard-sidebar .dash-tab-btn {
        min-width: 100px;
        padding: 8px 10px;
        font-size: 0.75rem;
    }
    
    .tab-icon {
        font-size: 0.9rem;
        min-width: 18px;
    }
    
    .tab-label {
        font-size: 0.7rem;
    }
    
    .dashboard-main {
        padding: 15px 10px;
    }
    
    .form-section {
        padding: 20px 15px;
    }
}