:root {
    --primary: #008751;
    --primary-dark: #006b40;
    --primary-light: #e6f3ed;
    --secondary: #2c3e50;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --accent: #ffb800;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
}

h1, h2, h3, .vfr-logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

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

/* Header */
.main-header {
    background-color: var(--white);
    padding: 1.5rem 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vfr-logo {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.logo h1 {
    font-size: 1.25rem;
    color: var(--primary-dark);
}

.role-selector {
    display: flex;
    background: var(--gray-100);
    padding: 4px;
    border-radius: var(--radius-md);
    gap: 4px;
}

.role-btn {
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    color: var(--gray-600);
    background: transparent;
}

.role-btn.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.role-btn i {
    width: 18px;
    height: 18px;
}

/* Main Content */
main {
    padding-top: 3.5rem;
    padding-bottom: 4rem;
    min-height: calc(100vh - 160px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.hidden {
    display: none !important;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 4px 14px 0 rgba(0, 135, 81, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(0, 135, 81, 0.4);
}

.btn-secondary.btn-sm {
    padding: 6px 14px;
    font-size: 0.9rem;
}

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--primary-light);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--gray-600);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.btn-text:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

/* Cards & Grid */
.event-groups-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.event-group {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--gray-100);
}

.event-group-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
    background: var(--white);
}

.event-group-header:hover {
    background: var(--gray-50);
}

.group-title-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-title-info h3 {
    font-size: 1.1rem;
    margin: 0;
    color: var(--gray-800);
}

.event-count-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 700;
}

.toggle-icon {
    transition: transform 0.3s ease;
    color: var(--gray-600);
}

.event-group.expanded .toggle-icon {
    transform: rotate(180deg);
}

.event-group-content {
    display: none;
    padding: 1.5rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.event-group.expanded .event-group-content {
    display: grid;
}

.grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.event-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.event-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.event-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.badge-training { background: #e0f2fe; color: #0369a1; }
.badge-tournament { background: #fef3c7; color: #b45309; }

.event-card h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--gray-800);
}

.event-meta {
    color: var(--gray-600);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-item i { width: 16px; height: 16px; }

/* Login Card */
.login-card {
    max-width: 400px;
    margin: 4rem auto;
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-card h2 { margin-bottom: 1rem; }
.login-card p { color: var(--gray-600); margin-bottom: 2rem; }

.input-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

input, select, textarea {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    font-family: inherit;
    font-size: 1rem;
    width: 100%;
    transition: var(--transition);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Detail View */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 20px;
    flex-wrap: wrap;
}

.back-nav {
    width: 100%;
    margin-bottom: 1rem;
}

#event-info-header h2 {
    font-size: 2rem;
    margin: 8px 0;
}

.trip-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 2.5rem;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 2px;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 12px 24px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    transition: var(--transition);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
}

.carpool-sections {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 40px;
}

h3 { margin-bottom: 1.5rem; display: flex; align-items: center; gap: 10px; }

/* My Car / Adding Car */
.car-card-empty {
    background: var(--white);
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    color: var(--gray-600);
}

.car-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border-left: 5px solid var(--primary);
}

.car-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.car-header h4 { font-size: 1.25rem; }

.seats-indicator {
    display: flex;
    gap: 4px;
    margin: 1rem 0;
}

.seat {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: var(--gray-200);
}

.seat.booked { background: var(--primary); }

.car-remarks {
    margin: 1rem 0;
    padding: 10px 12px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
}

.car-remarks i {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.booked-list {
    font-size: 0.9rem;
    color: var(--gray-600);
}

.booked-list span {
    display: inline-block;
}

.booking-note {
    color: var(--primary);
    font-style: italic;
    font-weight: 500;
}

.booked-list strong { color: var(--gray-800); }

/* Car Grid */
.car-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.other-car-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-100);
}

.car-footer {
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.seats-count {
    font-weight: 700;
    color: var(--primary);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

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

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 2rem;
}

/* Footer */
footer {
    background: var(--white);
    padding: 2rem 0;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    color: var(--gray-600);
    font-size: 0.9rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .carpool-sections {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .detail-header {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Event Availability Overview */
.event-availability-overview {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--gray-200);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.availability-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    align-items: center;
}

.availability-item .label {
    color: var(--gray-600);
    font-weight: 500;
}

.availability-item .value {
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: 4px;
}

.availability-item .value.full {
    color: #ef4444;
    background: #fee2e2;
}

/* Activity Feed Styles */
.activity-item {
    background: var(--white);
    padding: 12px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-item .activity-user {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
}

.activity-item .activity-text {
    font-size: 0.85rem;
    color: var(--gray-800);
}

.activity-item .activity-time {
    font-size: 0.7rem;
    color: var(--gray-600);
    margin-top: 4px;
}

/* AI Chat Assistant Styles */
.chat-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 135, 81, 0.4);
    cursor: pointer;
    z-index: 2000;
    transition: var(--transition);
}

.chat-fab:hover {
    transform: scale(1.1) rotate(5deg);
}

.chat-fab .pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.6;
    animation: pulse-ring 2s infinite;
    z-index: -1;
}

@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(1.5); opacity: 0; }
}

.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 2000;
    animation: slideUp 0.3s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-header {
    background: var(--primary);
    color: var(--white);
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-avatar {
    width: 32px;
    height: 32px;
    background: var(--white);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
}

.chat-header h4 { margin: 0; font-size: 1rem; }
.chat-header .status { font-size: 0.7rem; opacity: 0.8; }

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    max-width: 85%;
    line-height: 1.4;
}

.message.ai {
    background: var(--gray-100);
    color: var(--gray-800);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.user {
    background: var(--primary);
    color: var(--white);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--gray-100);
    display: flex;
    gap: 10px;
    background: var(--white);
}

.chat-input-area input {
    margin: 0;
    padding: 8px 12px;
    font-size: 0.9rem;
}

@media (max-width: 480px) {
    .chat-window {
        width: calc(100% - 40px);
        right: 20px;
        bottom: 90px;
    }
}
