* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #fff;
    color: #211922;
}

/* HEADER */
header {
    position: sticky;
    top: 0;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 12px 16px;
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #e60023;
    text-decoration: none;
}

.search-bar {
    flex: 1;
    max-width: 800px;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: #efefef;
    border-radius: 24px;
    font-size: 16px;
}

.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-links a {
    padding: 8px 16px;
    text-decoration: none;
    color: #333;
    border-radius: 24px;
    transition: background 0.2s;
}

.nav-links a:hover {
    background: #efefef;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary {
    background: #e60023;
    color: white;
}

.btn-primary:hover {
    background: #ad081b;
}

/* CONTAINER */
.container {
    max-width: 1600px;
    margin: 20px auto;
    padding: 0 16px;
}

/* MASONRY GRID */
.masonry-grid {
    column-count: 5;
    column-gap: 16px;
}

@media (max-width: 1400px) {
    .masonry-grid { column-count: 4; }
}

@media (max-width: 1100px) {
    .masonry-grid { column-count: 3; }
}

@media (max-width: 768px) {
    .masonry-grid { column-count: 2; }
}

@media (max-width: 480px) {
    .masonry-grid { column-count: 1; }
}

/* PIN CARD */
.pin-card {
    break-inside: avoid;
    margin-bottom: 16px;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    cursor: zoom-in;
    transition: transform 0.2s;
}

.pin-card:hover {
    transform: scale(1.02);
}

.pin-card img {
    width: 100%;
    display: block;
    border-radius: 16px;
}

.pin-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.pin-card:hover .pin-overlay {
    opacity: 1;
}

.btn-save {
    background: #e60023;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-weight: 600;
    cursor: pointer;
    font-size: 16px;
}

.btn-save:hover {
    background: #ad081b;
}

.pin-info {
    padding: 12px;
}

.pin-info h3 {
    font-size: 16px;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pin-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pin-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pin-author img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.pin-author span {
    font-size: 14px;
    font-weight: 600;
}

.pin-stats {
    display: flex;
    gap: 12px;
    font-size: 14px;
    color: #767676;
}

/* AUTH PAGES */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.auth-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #efefef;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #e60023;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    color: #767676;
}

.auth-link a {
    color: #e60023;
    text-decoration: none;
    font-weight: 600;
}

/* ALERTS */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fee;
    color: #c00;
    border: 1px solid #fcc;
}

.alert-success {
    background: #efe;
    color: #0a0;
    border: 1px solid #cfc;
}

/* UPLOAD FORM */
.upload-container {
    max-width: 800px;
    margin: 40px auto;
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.upload-form {
    margin-top: 30px;
}

#preview img {
    max-width: 100%;
    margin-top: 16px;
    border-radius: 8px;
}

/* PIN CARD - Version cliquable */
.pin-card {
    break-inside: avoid;
    margin-bottom: 16px;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    cursor: pointer; /* Curseur pointeur sur toute la carte */
    transition: transform 0.2s, box-shadow 0.2s;
}

.pin-card:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.pin-card img {
    width: 100%;
    display: block;
    border-radius: 16px 16px 0 0;
    pointer-events: none; /* Empêche le double clic sur l'image */
}

.pin-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 60px; /* Laisser de la place pour pin-info */
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.pin-card:hover .pin-overlay {
    opacity: 1;
}

.btn-save {
    background: #e60023;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-weight: 600;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
    z-index: 10; /* Pour que le bouton soit cliquable */
}

.btn-save:hover {
    background: #ad081b;
}

.pin-info {
    padding: 12px;
    background: white;
    position: relative;
    z-index: 5;
}

.pin-info h3 {
    font-size: 16px;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pin-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pin-author {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.pin-author:hover {
    opacity: 0.7;
}

.pin-author img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    pointer-events: none;
}

.pin-author span {
    font-size: 14px;
    font-weight: 600;
}

.pin-stats {
    display: flex;
    gap: 12px;
    font-size: 14px;
    color: #767676;
}

.pin-stats span {
    pointer-events: none;
}
