/* Index page specific styles */

body {
    display: flex;
    flex-direction: column;
}

#header-carousel-image {
    opacity: 1;
    transition: opacity 0.6s ease-in-out;
}

#header-carousel-image.fading {
    opacity: 0;
}

#church-hotspot {
    position: absolute;
    top: 52%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    /* border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.45); */
    background: rgba(255, 255, 255, 0);
    cursor: default;
    z-index: 5;
    /* transition: background 0.2s ease, border-color 0.2s ease; */
}
/*
#church-hotspot:hover,
#church-hotspot:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.85);
    outline: none;
} */

main {
    flex: 1;
    background: white;
    margin: 30px auto;
    max-width: 1400px;
    width: 95%;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.title-date-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

h1 {
    margin: 0;
    font-size: 2.5em;
}

.date-brocante {
    font-size: 1.2em;
    color: var(--secondary-color);
    font-weight: 600;
    padding: 12px 24px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eaf6 100%);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.3s ease;
}

.date-brocante:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
    background: linear-gradient(135deg, #e8eaf6 0%, #f5f7fa 100%);
}

.date-brocante::before {
    content: '🗓️';
    font-size: 1.3em;
}

.top-section {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    margin-bottom: 0px;
}

#user-section {
    background: var(--gradient-light);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    height: fit-content;
}

#login-form {
    max-width: 100%;
}

#login-form h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.3em;
}

#login-form form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#login-form p {
    text-align: center;
    margin-top: 15px;
    color: var(--text-light);
}

.forgot-password-link {
    margin-top: 10px;
    margin-bottom: 0;
    font-size: 0.95em;
}

#login-form a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

#login-form a:hover {
    text-decoration: underline;
}

#user-info {
    text-align: center;
}

#user-info p {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: var(--text-dark);
    font-weight: 500;
}

#user-name {
    color: var(--primary-color);
    font-weight: 700;
}

#user-info a {
    margin: 10px 0;
    padding: 12px 16px;
    background: white;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: block;
    font-size: 0.9em;
    line-height: 1.4;
    width: 100%;
    box-sizing: border-box;
}

#user-info a:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#user-info button {
    background: var(--gradient-danger);
    color: white;
    margin-top: 10px;
    width: 100%;
}

#user-info button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.4);
}

.right-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.terrain-controls {
    display: flex;
    justify-content: flex-start;
    gap: 5px;
    margin: 25px 0 0 0;
    padding: 0;
}

.terrain-controls button {
    background: #e8eaf6;
    border: 2px solid #d1d5f0;
    border-bottom: none;
    color: var(--primary-color);
    padding: 16px 40px;
    font-size: 1.2em;
    font-weight: 600;
    border-radius: 12px 12px 0 0;
    box-shadow: none;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    top: 2px;
}

.terrain-controls button:hover:not(.active) {
    background: #f3f4fb;
    color: var(--secondary-color);
    top: 0;
}

.terrain-controls button:active {
    transform: translateY(0);
}

.terrain-controls button.active {
    background: white;
    color: var(--primary-color);
    border-color: #d1d5f0;
    box-shadow: 0 -2px 8px rgba(102, 126, 234, 0.15);
    font-weight: 700;
    z-index: 1;
}

.terrain-controls button.active:hover {
    background: white;
    color: var(--primary-color);
    transform: translateY(0);
}

.legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 12px 0;
    flex-wrap: wrap;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    font-weight: 500;
}

.legend-color {
    width: 28px;
    height: 16px;
    border-radius: 4px;
    border: 2px solid;
    flex-shrink: 0;
}

.legend-color.available { background-color: rgba(76, 175, 80, 0.5); border-color: #4CAF50; }
.legend-color.handicap { background-color: rgba(0, 100, 220, 0.55); border-color: #003D99; border-style: dashed; }
.legend-color.selected { background-color: rgba(100, 100, 100, 0.65); border-color: #424242; }
.legend-color.pending { background-color: rgba(255, 193, 7, 0.6); border-color: #FFC107; }
.legend-color.confirmed { background-color: rgba(244, 67, 54, 0.6); border-color: #F44336; }

.map-container {
    position: relative;
    background: white;
    padding: 20px;
    border-radius: 0 12px 12px 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin: 0 0 25px 0;
    overflow: hidden;
    border: 2px solid #d1d5f0;
    touch-action: none; /* let JS handle all touch gestures */
}

.map-inner {
    position: relative;
    display: inline-block;
    transform-origin: 0 0;
    will-change: transform;
    cursor: grab;
}

.map-inner:active {
    cursor: grabbing;
}

.zoom-reset-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 20;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 7px 13px;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: background 0.2s;
    backdrop-filter: blur(4px);
}

.zoom-reset-btn:hover {
    background: rgba(102, 126, 234, 1);
    transform: none;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}

/* Mobile zoom hint */
.zoom-hint {
    display: none;
    text-align: center;
    font-size: 0.78em;
    color: #888;
    margin: 4px 0 -4px;
}

@media (pointer: coarse) {
    .zoom-hint { display: block; }
}

.map-image {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
}

svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.parcelle-polygon {
    fill: rgba(76, 175, 80, 0.4);
    stroke: #4CAF50;
    stroke-width: 2.5;
    cursor: pointer;
    transition: fill 0.2s ease, stroke 0.2s ease;
    pointer-events: all;
}

.parcelle-polygon:hover {
    fill: rgba(76, 175, 80, 0.7);
    stroke: #2e7d32;
}

.parcelle-polygon.selected {
    fill: rgba(100, 100, 100, 0.65);
    stroke: #424242;
    stroke-width: 2.5;
}

.parcelle-polygon.en_cours_de_paiement {
    fill: rgba(255, 193, 7, 0.6);
    stroke: #FFC107;
    stroke-width: 2;
    cursor: not-allowed;
    pointer-events: none;
}

.parcelle-polygon.handicap {
    fill: rgba(0, 100, 220, 0.55);
    stroke: #003D99;
    stroke-width: 3;
    stroke-dasharray: 7 3;
}

.parcelle-polygon.handicap:hover {
    fill: rgba(0, 100, 220, 0.8);
    stroke: #002266;
}

.parcelle-polygon.confirmee {
    fill: rgba(244, 67, 54, 0.6);
    stroke: #F44336;
    stroke-width: 2;
    cursor: not-allowed;
    pointer-events: none;
}

#cart {
    background: var(--gradient-light);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    min-height: 140px;
}

.cart-instructions {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.cart-instructions strong {
    color: var(--primary-color);
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#cart h2 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.4em;
}

.cart-total {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--secondary-color);
}

.cart-items-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 70px;
    margin-bottom: 15px;
    align-content: flex-start;
}

.cart-item {
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    padding: 8px 28px 8px 14px;
    font-weight: 600;
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.2s ease;
    position: relative;
}

.cart-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.cart-item-num {
    flex: 1;
}

.cart-item-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    line-height: 1;
}

.cart-item-remove:hover {
    background: #c0392b;
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.cart-empty {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

#cart button {
    width: 100%;
    background: var(--gradient-success);
    color: white;
    padding: 14px;
    font-size: 1.1em;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    transition: all 0.3s ease;
}

#cart button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.5);
}

@media (max-width: 768px) {
    main {
        padding: 20px;
        margin: 15px auto;
        width: 98%;
    }

    h1 {
        font-size: 1.8em;
    }

    .title-date-container {
        gap: 12px;
        margin-bottom: 20px;
    }

    .top-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Hide verbose instructions on mobile to save space */
    .cart-instructions {
        display: none;
    }

    /* Keep terrain controls as horizontal tabs (not column) */
    .terrain-controls {
        flex-direction: row;
        gap: 4px;
    }

    .terrain-controls button {
        flex: 1;
        padding: 12px 8px;
        font-size: 1em;
    }

    .map-container {
        padding: 10px;
    }

    .legend {
        gap: 10px;
        padding: 8px 10px;
    }

    .legend-item {
        font-size: 0.78em;
    }
}

@media (max-width: 480px) {
    main {
        padding: 15px;
        width: 100%;
        border-radius: 0;
        margin: 0;
        box-shadow: none;
    }

    h1 {
        font-size: 1.3em;
    }

    .date-brocante {
        font-size: 0.9em;
        padding: 8px 12px;
    }

    .terrain-controls button {
        font-size: 0.85em;
        padding: 10px 5px;
    }

    .map-container {
        padding: 6px;
        border-radius: 0 8px 8px 8px;
    }

    .legend {
        gap: 6px;
    }

    .legend-item {
        font-size: 0.7em;
    }

    .legend-color {
        width: 20px;
        height: 12px;
    }

    #cart {
        padding: 15px;
    }

    #cart h2 {
        font-size: 1.1em;
    }

    .cart-total {
        font-size: 1.1em;
    }
}
