/*
###############################################################################################################################################################
TRIPS
###############################################################################################################################################################
*/

:root {
    --primary-color: #ff7500;
    --primary-hover: #e65c00;
    --secondary-color: #2c3e50;
    --accent-color: #ffd700;
    --light-color: #f8f9fa;
    --dark-color: #232526;
    --grey-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.2), 0 6px 6px rgba(0, 0, 0, 0.15), inset 4px 4px 8px rgba(0, 0, 0, 0.05), inset -4px -4px 8px rgba(255, 255, 255, 0.3);
    --radius-sm: 5px;
    --radius-md: 10px;
    --radius-lg: 20px;
    --transition-fast: all 0.2s ease;
    --transition-normal: all 0.3s ease;
    --transition-slow: all 0.5s ease;
    --font-main: 'Poppins', sans-serif;
}

/*
###############################################################################################################################################################
PAGE LAYOUT
###############################################################################################################################################################
*/

.trips-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--LIGHTER_BLUE);
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s ease;
    flex-direction: column;
    overflow: hidden;
}

.trips-container.open {
    display: flex;
    opacity: 1;
}

.trips-container.closing {
    opacity: 0;
}

.trips-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	background-color: var(--DARK_BLUE);
	padding: 0.8rem 1rem;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.trips-title {
	display: flex;
	align-items: center;
	font-size: 1.1rem;
	font-weight: bold;
	margin: 0;
	color: var(--WHITE);
}

.trips-icon {
	font-size: 16px;
	margin-right: 8px;
	color: var(--ORANGE_50);
}

.close-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--WHITE);
    cursor: pointer;
    font-size: 1.8rem;
    padding: 0;
    transition: var(--transition-normal);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: var(--WHITE);
    background-color: var(--ORANGE_50);
}

.trips-body {
	flex: 1;
	overflow-y: auto;
    overscroll-behavior-y: contain; /* Disable the pull-to-refresh inside */
    -webkit-overflow-scrolling: touch; /* iOS: fluid scroll */
	padding: 2rem 10% 0rem 10%;
	color: var(--WHITE);
}

.dashboard-layout {
    display: flex;
    flex-direction: row;
    gap: 20px;
    width: 100%;
    max-width: 1550px;
    margin: 0 auto;
}

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

/*
###############################################################################################################################################################
TRIPS CONTENT
###############################################################################################################################################################
*/

.trips-content-wrapper {
    margin-bottom: 20px;
}

.info-message {
    background-color: rgba(12, 37, 51, 0.4);
    border-left: 4px solid var(--ORANGE_50);
    padding: 15px;
    margin-bottom: 2rem;
    color: var(--BEIGE);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}

.info-message i {
    color: var(--ORANGE_50);
    margin-right: 10px;
    font-size: 1.2rem;
}

.view-controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.view-button {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--GREY_40);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-normal);
    color: var(--BEIGE);
}

.view-button i {
    margin-right: 8px;
}

.view-button.active {
    background-color: var(--ORANGE_50);
    color: white;
    border-color: var(--ORANGE_50);
}

.view-button:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: var(--ORANGE_50);
    transform: translateY(-2px);
}

/*
###############################################################################################################################################################
VIEW CONTAINERS
###############################################################################################################################################################
*/

.view-container {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.view-container.active {
    display: block;
    opacity: 1;
}

/*
###############################################################################################################################################################
LIST VIEW
###############################################################################################################################################################
*/

.table-responsive {
    background-color: var(--BEIGE);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
}

.table thead th {
    background-color: var(--BEIGE);
    color: var(--secondary-color);
    font-weight: 600;
    padding: 15px 10px;
    text-align: left;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
}

.table thead th:nth-child(1) { width: 20%; } /* Nom - plus large pour le contenu principal */
.table thead th:nth-child(2) { width: 15%; } /* Destination */
.table thead th:nth-child(3) { width: 17%; } /* Dates */
.table thead th:nth-child(4) { width: 8%; }  /* Durée - compact */
.table thead th:nth-child(5) { width: 8%; }  /* Voyageurs - compact */
.table thead th:nth-child(6) { width: 10%; } /* Créé */
.table thead th:nth-child(7) { width: 10%; } /* Modifié */
.table thead th:nth-child(8) { width: 12%; } /* Partagé (si présent) */
.table thead th:last-child { width: 10%; }   /* Actions - compact mais suffisant */

.table thead th:last-child, /* Actions */
.table thead th:nth-child(8), /* Partagé (si présent) */
.table td:nth-child(5) { /* Voyageurs */
    text-align: center;
    white-space: nowrap;
}

.table tbody tr {
    transition: var(--transition-normal);
    border-bottom: 1px solid #f1f3f5;
}

.table tbody tr:last-child {
    border-bottom: none;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.table td {
    padding: 15px 10px;
    vertical-align: middle;
    color: var(--DARK_BLUE);
}

.destination-badge, .duration-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), #ff9d50);
    color: var(--BEIGE);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.shared-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--success-color), #5ddf82);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.not-shared-badge {
    display: inline-block;
    background-color: #e9ecef;
    color: var(--grey-color);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.trip-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--grey-color);
    font-size: 1rem;
    transition: var(--transition-normal);
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-trip-btn:hover {
    color: var(--info-color);
    background-color: rgba(52, 152, 219, 0.1);
}

.share-btn:hover {
    color: var(--warning-color);
    background-color: rgba(40, 167, 69, 0.1);
}

.rename-btn:hover {
    color: var(--success-color);
    background-color: rgba(255, 193, 7, 0.1);
}

.delete-btn:hover {
    color: var(--danger-color);
    background-color: rgba(220, 53, 69, 0.1);
}

.inline-form {
    display: inline;
}

/*
###############################################################################################################################################################
GRID VIEW
###############################################################################################################################################################
*/

.trips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

.trip-card {
    background-color: var(--BEIGE);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.trip-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.trip-card-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), #ff9d50);
    color: white;
    position: relative;
}

.trip-card-header h3 {
    margin: 0 0 15px 0;
    font-weight: 700;
    font-size: 1.3rem;
}

.destination-tag {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    backdrop-filter: blur(5px);
}

.trip-card-body {
    padding: 20px;
    flex-grow: 1;
}

.trip-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.trip-info p {
    margin: 0;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
}

.trip-info p i {
    width: 20px;
    margin-right: 10px;
    color: var(--primary-color);
}

.trip-card-footer {
    padding: 15px 20px;
    border-top: 1px solid #f1f3f5;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.card-action-btn {
    flex: 1;
    padding: 8px 0;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.card-action-btn i {
    font-size: 0.85rem;
}

.card-action-btn.view-trip-btn {
    background-color: var(--info-color);
    color: white;
}

.card-action-btn.view-trip-btn:hover {
    background-color: #2980b9;
}

.card-action-btn.rename-btn {
    background-color: var(--success-color);
    color: white;
}

.card-action-btn.rename-btn:hover {
    background-color: #218838;
}

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

.card-action-btn.delete-btn:hover {
    background-color: #bd2130;
}

.delete-form {
    flex: 1;
}

/*
###############################################################################################################################################################
TIMELINE VIEW
###############################################################################################################################################################
*/

.timeline {
    position: relative;
    margin: 0 auto;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 6px;
    background-color: #e9ecef;
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -3px;
    border-radius: 3px;
}

.timeline-item {
    padding: 10px 40px;
    position: relative;
    width: 50%;
    box-sizing: border-box;
    margin-bottom: 30px;
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: white;
    border: 4px solid var(--primary-color);
    top: 15px;
    border-radius: 50%;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}

.timeline-item.left {
    left: 0;
}

.timeline-item.right {
    left: 50%;
}

.timeline-item.left::after {
    right: -10px;
}

.timeline-item.right::after {
    left: -10px;
}

.timeline-content {
    background-color: var(--BEIGE);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
    transition: var(--transition-normal);
}

.timeline-content:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.timeline-date {
    position: absolute;
    top: -10px;
    background: linear-gradient(135deg, var(--primary-color), #ff9d50);
    color: white;
    border-radius: 20px;
    padding: 5px 15px;
    font-size: 0.85rem;
    font-weight: 500;
}

.timeline-item.left .timeline-date {
    right: 20px;
}

.timeline-item.right .timeline-date {
    left: 20px;
}

.timeline-content h3 {
    margin: 20px 0 15px 0;
    color: var(--secondary-color);
    font-weight: 600;
}

.timeline-badge {
    display: inline-block;
    background-color: #f8f9fa;
    color: var(--secondary-color);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.timeline-details {
    margin-bottom: 15px;
}

.timeline-details p {
    margin: 5px 0;
    color: var(--grey-color);
    display: flex;
    align-items: center;
}

.timeline-details p i {
    width: 20px;
    margin-right: 10px;
    color: var(--primary-color);
}

.timeline-details p i.fa-share-alt {
    color: var(--success-color);
}

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

.timeline-btn {
    flex: 1;
    min-width: 100px;
    padding: 8px 15px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.timeline-btn i {
    font-size: 0.85rem;
}

.timeline-btn.view-trip-btn {
    background-color: var(--info-color);
    color: white;
}

.timeline-btn.view-trip-btn:hover {
    background-color: #2980b9;
}

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

.timeline-btn.rename-btn:hover {
    background-color: #218838;
}

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

.timeline-btn.delete-btn:hover {
    background-color: #bd2130;
}

.timeline-delete-form {
    flex: 1;
    min-width: 100px;
}

/*
###############################################################################################################################################################
EMPTY STATE
###############################################################################################################################################################
*/

.empty-state {
    text-align: center;
    padding: 50px 20px;
}

.empty-icon {
    font-size: 4rem;
    color: #d1d6db;
    margin-bottom: 20px;
}

.empty-state p {
    color: var(--grey-color);
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.create-trip-btn {
    display: inline-block;
    background-color: var(--primary-color) !important;
    color: white !important;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-normal);
}

.create-trip-btn:hover {
    background-color: var(--primary-hover) !important;
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}

/*
###############################################################################################################################################################
MODAL
###############################################################################################################################################################
*/

.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    margin: 0;
    padding: 0;
}

.modal-content {
    background-color: var(--DARK_BLUE);
    margin: 0;
    width: 90%;
    max-width: 400px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    overflow: hidden;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: var(--BEIGE);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-normal);
}

.close:hover {
    color: var(--secondary-color);
}

.modal-content h2 {
    margin: 0;
    padding: 20px;
    color: var(--BEIGE);
    background-color: var(--primary-color);
    font-size: 1.3rem;
    font-weight: 600;
    border-bottom: 1px solid #e9ecef;
}

.modal-body {
    padding: 20px;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--FORM_ICON_COLOR);
}

#modalInput {
    width: 100%;
    padding: 12px 10px 12px 35px;
    border: 1px solid #e9ecef;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition-normal);
    background-color: var(--FORM_INPUT_BACKGROUND);
}

#modalInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 117, 0, 0.2);
}

.modal-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
}

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

/*
###############################################################################################################################################################
SHARE MODAL
###############################################################################################################################################################
*/

.share-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.share-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
    color: white;
}

.share-option[data-platform="facebook"] {
    background-color: #3b5998;
}

.share-option[data-platform="twitter"] {
    background-color: #1da1f2;
}

.share-option[data-platform="whatsapp"] {
    background-color: #25d366;
}

.share-option[data-platform="email"] {
    background-color: #ea4335;
}

.share-option:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.share-link-container {
    margin-top: 20px;
}

.share-link-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--secondary-color);
}

.share-link-container .input-group {
    display: flex;
    margin-bottom: 0;
}

.share-link-container input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e9ecef;
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-size: 0.9rem;
}

.copy-link-btn {
    padding: 0 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    transition: var(--transition-normal);
}

.copy-link-btn:hover {
    background-color: var(--primary-hover);
}

/* Styles pour l'affichage des boutons de partage dans la vue Grid */
.card-action-btn.share-btn {
    background-color: var(--warning-color);
    color: white;
}

.card-action-btn.share-btn:hover {
    background-color: #d39e00;
}

/* Styles pour l'affichage des boutons de partage dans la vue Timeline */
.timeline-btn.share-btn {
    background-color: var(--warning-color);
    color: white;
}

.timeline-btn.share-btn:hover {
    background-color: #d39e00;
}

/*
###############################################################################################################################################################
ANIMATIONS
###############################################################################################################################################################
*/

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

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

@keyframes slideInFromRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes glowPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 117, 0, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(255, 117, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 117, 0, 0); }
}

/*
###############################################################################################################################################################
RESPONSIVE
###############################################################################################################################################################
*/

@media (max-width: 1200px) {
    .timeline::after {
        left: 31px;
    }
    
    .timeline-item {
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
    }
    
    .timeline-item.right {
        left: 0;
    }
    
    .timeline-item.left::after,
    .timeline-item.right::after {
        left: 21px;
    }
    
    .timeline-item.left .timeline-date,
    .timeline-item.right .timeline-date {
        left: 70px;
    }
}

@media (max-width: 992px) {
    .dashboard-layout {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .view-controls {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .table-responsive {
        padding: 10px;
    }
    
    .table thead {
        display: none;
    }
    
    .table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #e9ecef;
        border-radius: var(--radius-md);
        padding: 10px;
    }
    
    .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 10px 0;
        border-bottom: 1px solid #f1f3f5;
    }
    
    .table td:last-child {
        border-bottom: none;
    }
    
    .table td::before {
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        color: var(--secondary-color);
    }
    
    .table td[data-label="Voyageurs"] {
        justify-content: space-between;
        gap: 5px;
    }
    
    .table td[data-label="Voyageurs"]::before {
        text-align: left;
        margin-right: auto;
    }
    
    .table td[data-label="Partagé avec"] {
        justify-content: space-between;
    }
    
    .table td[data-label="Partagé avec"]::before {
        text-align: left;
        margin-right: auto;
    }

    td[data-label="Voyageurs"] i.fa-user,
    td[data-label="Voyageurs"] i.fa-users {
        margin-left: 5px;
    }
    
    .trips-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .view-controls {
        flex-wrap: wrap;
    }
    
    .view-button {
        flex: 1;
    }
    
    .timeline-actions {
        flex-direction: column;
    }
    
    .timeline-btn {
        width: 100%;
    }
    
    .timeline-delete-form {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .dashboard-layout {
        gap: 15px;
    }
    
    .trip-actions {
        flex-wrap: wrap;
    }
    
    .action-btn {
        flex: 1;
    }
}