/* ================================================================ */
/* === CSS COMMUN POUR TOUTES LES PAGES PRODUCTEUR =============== */
/* === Pages: connexionproducteurs, consultation-appeloffre, etc = */
/* ================================================================ */

/* Import des variables centralisées */
@import url('variables.css');

/* === RESET & BASE =============================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacMacSystemFont, 'Segoe UI', Roboto, 'Noto Color Emoji', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 3rem;
    flex-grow: 1;
}

/* === HEADER ==================================================== */
.header {
    background: var(--bg-card);
    padding: 0 3rem;
    height: 72px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-light);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-image {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent-wine) 0%, var(--accent-copper) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    box-shadow: var(--shadow-md);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-wine), var(--accent-copper));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.header-nav {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--accent-wine);
    background: rgba(124, 10, 41, 0.08);
}

.nav-link.active {
    color: var(--accent-wine);
    background: rgba(124, 10, 41, 0.12);
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

#headerUserName {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-wine), var(--accent-copper));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* === DROPDOWN MENU ============================================= */
.dropdown-menu {
    position: absolute;
    top: 55px;
    right: 0;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    padding: 0.5rem;
    min-width: 260px;
    max-width: 320px;
    display: none;
    z-index: 2000;
    border: 1px solid var(--border-light);
    max-height: 80vh;
    overflow-y: auto;
}

.dropdown-menu.show-menu {
    display: block;
    animation: fadeIn 0.2s ease;
}

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

.dropdown-menu a,
.dropdown-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    border-radius: 8px;
    cursor: pointer;
}

.dropdown-menu a:hover,
.dropdown-menu .menu-item:hover {
    background: var(--bg-main);
    color: var(--accent-wine);
}

.menu-item {
    position: relative;
    justify-content: space-between;
}

.menu-item i.fa-chevron-right {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.menu-item.expanded i.fa-chevron-right {
    transform: rotate(90deg);
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-left: 1.5rem;
}

.submenu.expanded {
    max-height: 500px;
}

.submenu a {
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
    margin: 0.2rem 0;
}

.menu-section-divider {
    border-top: 1px solid var(--border-light);
    margin: 0.5rem 0;
}

.dropdown-menu .logout {
    color: var(--warning);
    border-top: 1px solid var(--border-light);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

/* === WELCOME SECTION & STATS =================================== */
.main-content {
    background: transparent;
    padding: 0;
    max-width: 1400px;
    margin: 0 auto;
}

.welcome-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2.5rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.welcome-section h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--accent-wine), var(--accent-copper));
    padding: 2rem 1.5rem;
    border-radius: 12px;
    color: white;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
    transition: all 0.5s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.stat-icon-top {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.9;
    position: relative;
}

.stat-number-main {
    font-size: 3rem;
    font-weight: 800;
    position: relative;
    letter-spacing: -1px;
    margin-bottom: 0.8rem;
    line-height: 1;
}

/* Twemoji - Affichage des drapeaux comme images SVG */
#topVisitorsFlags {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

#topVisitorsFlags img.emoji {
    height: 1.8em;
    width: 1.8em;
    vertical-align: middle;
}

.stat-label-main {
    font-size: 0.95rem;
    opacity: 0.95;
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.3;
    position: relative;
}

.stat-details-row {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 500;
    position: relative;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    width: 100%;
}

.stat-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    align-items: center;
}

.stat-detail-label {
    opacity: 0.8;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

/* === MAIN GRID & FEATURE CARDS ================================= */
.main-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.feature-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.feature-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.feature-card.large-card {
    grid-column: span 3;
}

.feature-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-wine), var(--accent-copper));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    color: white;
    box-shadow: var(--shadow-md);
}

.feature-card h3 {
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.feature-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.feature-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-value {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.highlight-badge {
    background: var(--warning);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.feature-btn {
    width: 100%;
    padding: 0.9rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-wine), var(--accent-copper));
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: auto;
}

.feature-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* === CRM SECTION =============================================== */
.crm-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    text-align: center;
    margin-bottom: 2rem;
}

.crm-card h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 700;
}

.crm-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 500;
}

.crm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, var(--accent-wine), var(--accent-copper));
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.crm-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

/* === DASHBOARD SUBSECTIONS & CHARTS ============================ */
.dashboard-subsection {
    margin-bottom: 2rem;
}

.dashboard-subsection h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.dashboard-subsection h4 i {
    color: var(--accent-wine);
    font-size: 1rem;
}

.unified-stat-card {
    background: rgba(124, 10, 41, 0.02);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-light);
}

.unified-content {
    display: grid;
    grid-template-columns: 1fr 2.2fr;
    gap: 1.5rem;
    align-items: center;
}

.compact-stats-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mini-stat-compact {
    background: white;
    padding: 1rem 0.8rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.mini-stat-compact:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--accent-wine);
}

.mini-stat-compact .value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-wine);
    line-height: 1;
    margin-bottom: 0.4rem;
}

.mini-stat-compact .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    line-height: 1.3;
}

.chart-wrapper-unified {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.chart-wrapper-unified canvas {
    max-height: 200px;
}

.chart-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    text-align: center;
}

/* === WINE SHEETS CONTAINER ===================================== */
.wine-sheets-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.wine-sheet-compact {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(124, 10, 41, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.wine-sheet-compact::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-wine), var(--accent-copper));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.wine-sheet-compact:hover::before {
    transform: scaleX(1);
}

.wine-sheet-compact:hover {
    box-shadow: 0 8px 20px rgba(124, 10, 41, 0.15);
    border-color: rgba(124, 10, 41, 0.2);
    transform: translateY(-3px);
}

.wine-sheet-compact .wine-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.3;
    min-height: 2.6em;
}

.wine-stats-compact {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.wine-stat-item {
    flex: 1;
    background: rgba(124, 10, 41, 0.03);
    padding: 0.7rem;
    border-radius: 8px;
    text-align: center;
}

.wine-stat-item .value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent-wine);
    line-height: 1;
    margin-bottom: 0.3rem;
}

.wine-stat-item .label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.wine-visitors-origin {
    background: linear-gradient(135deg, rgba(124, 10, 41, 0.05), rgba(184, 115, 51, 0.05));
    padding: 0.8rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid rgba(124, 10, 41, 0.1);
}

.wine-visitors-origin .visitors-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.wine-visitors-origin .visitors-label i {
    color: var(--accent-wine);
}

.wine-visitors-origin .visitors-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.wine-visitors-origin .visitor-country {
    background: white;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.2s ease;
    /* Police système standard */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Twemoji dans les fiches vin */
.wine-visitors-origin .visitor-country img.emoji {
    height: 1.1em;
    width: 1.1em;
    vertical-align: middle;
}

.wine-visitors-origin .visitor-country:hover {
    border-color: var(--accent-wine);
    box-shadow: var(--shadow-sm);
}

.wine-visitors-origin .no-visitors {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-style: italic;
}

.wine-visitors-origin .visitor-country.unknown {
    background: rgba(0, 0, 0, 0.03);
    border-style: dashed;
    color: var(--text-tertiary);
}

.wine-visitors-origin .loading-text {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.wine-chart-wrapper {
    background: rgba(248, 249, 250, 0.5);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.wine-chart-wrapper canvas {
    max-height: 140px;
}

/* === LOADING & MESSAGES VINS ==================================== */
.loading-wines {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

.loading-wines i {
    color: var(--accent-wine);
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

.no-wines-message {
    text-align: center;
    padding: 3rem 2rem;
    background: rgba(124, 10, 41, 0.03);
    border-radius: 12px;
    border: 2px dashed rgba(124, 10, 41, 0.2);
}

.no-wines-message i {
    font-size: 3rem;
    color: var(--accent-wine);
    opacity: 0.5;
    margin-bottom: 1rem;
    display: block;
}

.no-wines-message p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--warning);
    background: rgba(192, 0, 0, 0.05);
    border-radius: 8px;
}

/* === LIEN ÉDITION VIN =========================================== */
.wine-edit-link {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: var(--text-tertiary);
    font-size: 0.9rem;
    opacity: 0;
    transition: all 0.3s ease;
}

.wine-sheet-compact:hover .wine-edit-link {
    opacity: 1;
}

.wine-edit-link:hover {
    color: var(--accent-wine);
}

/* === LOADING STATS ============================================== */
.loading-stats {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

.loading-stats i {
    color: var(--accent-wine);
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

.no-profile-message {
    text-align: center;
    padding: 2rem;
}

.no-profile-message i {
    font-size: 2.5rem;
    color: var(--accent-wine);
    opacity: 0.5;
    margin-bottom: 1rem;
    display: block;
}

.no-profile-message p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

/* === BADGE SANS NOTIFICATION ==================================== */
.no-badge {
    background: var(--text-tertiary) !important;
    opacity: 0.6;
}

/* === BUTTONS =================================================== */
.btn-primary {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-wine), var(--accent-copper));
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: white;
    color: var(--accent-wine);
    border: 2px solid var(--accent-wine);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--accent-wine);
    color: white;
    transform: translateY(-2px);
}

/* === SCROLLBAR ================================================= */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-wine);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-copper);
}

/* === COMING SOON CARDS ========================================= */
.coming-soon-card {
    position: relative;
    opacity: 0.75;
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(124, 10, 41, 0.03) 100%);
}

.coming-soon-card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

.coming-soon-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: var(--shadow-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.coming-soon-badge i {
    font-size: 0.65rem;
}

.coming-soon-card .feature-icon {
    background: linear-gradient(135deg, #6c757d, #495057);
    opacity: 0.8;
}

.coming-soon-card .feature-description {
    color: var(--text-tertiary);
}

.feature-btn.disabled {
    background: linear-gradient(135deg, #adb5bd, #6c757d);
    cursor: not-allowed;
    opacity: 0.7;
}

.feature-btn.disabled:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* === RESPONSIVE ================================================ */
@media (max-width: 1400px) {
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .feature-card.large-card {
        grid-column: span 2;
    }

    .wine-sheets-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem 1.5rem;
    }

    .header {
        padding: 1rem 1.5rem;
    }

    .header-nav {
        display: none;
    }

    .stats-bar {
        grid-template-columns: 1fr;
    }

    .main-grid {
        grid-template-columns: 1fr;
    }

    .feature-card.large-card {
        grid-column: span 1;
    }

    .unified-content {
        grid-template-columns: 1fr;
    }

    .wine-sheets-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .welcome-section {
        padding: 1.5rem;
    }

    .feature-card {
        padding: 1.5rem;
    }
}
