/* Portal Layout & Navigation */
.portal-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1000px;
    margin: 8rem auto 4rem;
    padding: 0 2rem;
}

.horizontal-nav {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.nav-item {
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    transition: 0.3s;
    white-space: nowrap;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
}

.nav-item.active {
    font-weight: 700;
}

.portal-card,
.card {
    background: var(--dark-lighter);
    border-radius: 24px;
    padding: 2.5rem;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.portal-card:hover,
.card:hover {
    border-color: var(--primary);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(-4px);
}

/* User Profile Header */
.user-profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 4rem;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    border: 4px solid var(--border);
}

.user-avatar-small {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Favorites List Items */
.fav-item {
    background: var(--dark-lighter);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    transition: 0.3s;
}

.fav-item:hover {
    border-color: var(--primary);
    transform: translateX(10px);
}

/* Review Styles (used in Map Details AND Profile) */
.review-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

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

.review-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.review-stars {
    color: #ffc107;
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Portal Specific Content Boxes */
.profile-section {
    background: var(--dark-lighter);
    padding: 3rem;
    border-radius: 32px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.profile-title {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: var(--primary);
}

.vehicle-card {
    background: var(--dark);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.vehicle-measurements {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.measurement-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
}

@media (max-width: 768px) {
    .vehicle-measurements {
        grid-template-columns: 1fr;
    }

    .profile-section,
    .portal-card,
    .card {
        padding: 1.5rem;
    }

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

/* Avatar Section for Settings */
.avatar-section {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    background: var(--primary);
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    overflow: hidden;
    border: 3px solid var(--border);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Forms & Inputs */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.form-group label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-input,
.profile-input,
section input[type="text"],
section input[type="number"],
section input[type="email"],
section input[type="password"],
section input[type="tel"],
section input[type="date"],
section select,
section textarea {
    padding: 0.8rem 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--light);
    font-family: inherit;
    font-size: 1rem;
    transition: 0.3s;
    width: 100%;
}

.form-input:focus,
.profile-input:focus,
section input:focus,
section select:focus,
section textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.status-msg {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    display: none;
}

.status-msg.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    display: block;
}

.status-msg.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    display: block;
}

/* Button Refinement */
.btn-save,
.btn-add,
.btn-new {
    background: var(--primary);
    color: var(--dark);
    padding: 1rem 2rem;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-save:hover,
.btn-add:hover,
.btn-new:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.2);
    filter: brightness(1.1);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

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

/* Switch UI */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(24px);
}

/* Trips List */
.trips-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.trip-item {
    background: var(--dark-lighter);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    display: flex;
    gap: 2rem;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

.trip-item:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.1);
}

.trip-thumb {
    width: 150px;
    height: 100px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--primary);
}

.trip-info h3 {
    margin: 0 0 0.5rem;
}

.trip-info p {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.9rem;
}

/* Modal System */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--dark-lighter);
    width: 90%;
    max-width: 500px;
    margin: 10% auto;
    padding: 2.5rem;
    border-radius: 24px;
    border: 1px solid var(--border);
    position: relative;
}

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

.stat-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    text-align: center;
}

.stat-val {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    display: block;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Favorites List (Grid variant) */
.favorites-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.fav-row {
    background: var(--dark-lighter);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
    gap: 1rem;
    transition: 0.3s;
}

.fav-row:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.fav-name {
    font-size: 1.1rem;
    color: var(--light);
}

.fav-date {
    color: var(--text-muted);
    text-align: center;
}

/* Trip Details & Timeline */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 2rem;
    transition: 0.3s;
    font-weight: 500;
}

.back-link:hover {
    color: var(--primary);
}

.trip-header {
    background: var(--dark-lighter);
    border-radius: 24px;
    padding: 3rem;
    border: 1px solid var(--border);
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

.trip-header h1 {
    margin: 0 0 1rem;
    font-size: 3rem;
    letter-spacing: -0.02em;
}

.trip-meta {
    color: var(--text-muted);
    display: flex;
    gap: 2rem;
    font-size: 1.1rem;
    flex-wrap: wrap;
}

.timeline {
    position: relative;
    padding-left: 3rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.entry-card {
    background: var(--dark-lighter);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    position: relative;
    transition: 0.3s;
}

.entry-card::before {
    content: '';
    position: absolute;
    left: -3rem;
    top: 2rem;
    width: 30px;
    height: 30px;
    background: var(--dark);
    border: 2px solid var(--primary);
    border-radius: 50%;
    z-index: 1;
}

.entry-card:hover .entry-actions {
    opacity: 1 !important;
}

.entry-date {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.entry-note {
    color: var(--text-muted);
    line-height: 1.6;
    white-space: pre-wrap;
}

#trip-map {
    height: 400px;
    width: 100%;
    border-radius: 24px;
    margin-bottom: 3rem;
    border: 1px solid var(--border);
    z-index: 1;
}

/* Specific buttons for Trip Detail */
.btn-add,
.btn-new {
    background: var(--primary);
    color: var(--dark);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: 0.3s;
}

.btn-add:hover,
.btn-new:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.2);
}