:root {
    --primary: #8b5cf6;
    --secondary: #10b981;
    --accent: #f59e0b;
    --danger: #ef4444;
    --bg-main: #0f172a;
    --bg-sidebar: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-secondary: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --accent-glow: rgba(245, 158, 11, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
aside {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

aside .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 3rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

aside nav {
    flex: 1;
}

aside nav .nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

aside nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

aside nav .nav-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* Main Content */
main {
    flex: 1;
    margin-left: 260px;
    padding: 2.5rem;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2.5rem;
}

.title-with-status {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--secondary);
    border-radius: 50%;
    animation: dotPulse 2s infinite;
}

@keyframes dotPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
}

.trip-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.4rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    gap: 0.25rem;
}

.trip-tab {
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-secondary);
    border: none;
    background: transparent;
}

.trip-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.trip-tab.active {
    background: var(--bg-main);
    color: white;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.add-tab-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
}

.add-tab-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-accent {
    background: var(--accent);
    color: #000;
    box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

/* Sections */
.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 20px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-footer {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

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

/* Forms & Tables */
.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

input, select {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: white;
    outline: none;
    transition: border-color 0.3s;
}

input:focus, select:focus {
    border-color: var(--primary);
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { opacity: 0.9; transform: scale(1.02); }

.btn-secondary { background: rgba(255, 255, 255, 0.05); color: white; }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }

/* Checklist */
.checklist-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    margin-bottom: 0.75rem;
}

.checklist-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.checklist-item.done span {
    text-decoration: line-through;
    color: var(--text-secondary);
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .grid-2 { grid-template-columns: 1fr; }
    aside { width: 80px; padding: 1rem; }
    aside .logo span, aside nav .nav-link span { display: none; }
    main { margin-left: 80px; }
}

/* Progress Bar */
.progress-bar-container {
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Toast System */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease-out forwards;
    min-width: 250px;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.success i { color: var(--secondary); }
.toast.warning i { color: var(--accent); }
.toast.danger i { color: var(--danger); }

/* Mobile Detection Overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(15px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.mobile-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.mobile-overlay-content {
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    padding: 3rem 2rem;
    border-radius: 30px;
    text-align: center;
    max-width: 85%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.mobile-icon-pulse {
    width: 80px;
    height: 80px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    position: relative;
}

.mobile-icon-pulse i {
    color: var(--primary);
    width: 35px;
    height: 35px;
}

.mobile-icon-pulse::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--primary);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.mobile-overlay h2 {
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.mobile-overlay p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-sidebar);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 0.75rem 1rem;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}

.mobile-nav .nav-link {
    color: var(--text-secondary);
    padding: 0.75rem;
    border-radius: 12px;
    transition: all 0.3s;
}

.mobile-nav .nav-link.active {
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .grid-2 { grid-template-columns: 1fr; }
    aside { width: 80px; padding: 1rem; }
    aside .logo span, aside nav .nav-link span, aside .sidebar-footer span { display: none; }
    main { margin-left: 80px; }
}

@media (max-width: 768px) {
    aside { display: none; }
    main { margin-left: 0; padding: 1.5rem; padding-bottom: 5rem; }
    .mobile-nav { display: flex; }
    .header-top { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .trip-selector { width: 100%; }
    .trip-selector select { flex: 1; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
    .stat-card { padding: 1rem; }
    .stat-value { font-size: 1.4rem; }
    .table-wrapper { margin: 0 -1.5rem; padding: 0 1.5rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* Utility */
.text-success { color: var(--secondary); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--accent); }

/* Suggestions Autocomplete */
.suggestions-container {
    position: absolute;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: auto;
    min-width: 300px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
}
.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    color: var(--text-main);
}
.suggestion-item:hover {
    background: rgba(255,255,255,0.1);
}
.suggestion-item:last-child {
    border-bottom: none;
}
