/* Fichier: style.css */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/* Consistent box model everywhere so width:100% + padding never overflows */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    max-width: 100%;
    overflow-x: hidden; /* kill the stray few-px horizontal scroll */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f2f5;
    /*display: flex;*/
    justify-content: center;
    /*align-items: center;*/
    min-height: 100vh;
    margin: 0;
    color: #333;
    /*margin-bottom: 40px !important;*/
}

.container {
    background-color: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px; /* Taille par défaut pour les formulaires */
    text-align: center;
    margin: 20px auto; /* Centrage et marge pour les conteneurs plus larges */
    height: fit-content;
    margin-bottom: 100px;;
}

.container.large {
    max-width: 900px; /* Conteneur plus large pour les listes ou dashboards */
    padding: 20px;
}

h2 {
    color: #333;
    margin-bottom: 25px;
    font-weight: 700;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
    width: calc(100% - 20px);
    padding: 12px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
textarea:focus,
select:focus {
    border-color: #007bff;
    outline: none;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

button {
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover {
    background-color: #0056b3;
    /*transform: translateY(-2px);*/
}

.message {
    margin-top: 20px;
    margin-bottom: 20px;
    padding: 10px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.links {
    margin-top: 20px;
    font-size: 15px;
}

.links a {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.links a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.dashboard-nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

a.button {
    background-color: #f8f9fa;
    color: #007bff;
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
    border: 1px solid #007bff;
}

a.button:hover {
    background-color: #e2e6ea;
}

/* Table styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    border: 1px solid #eee;
    padding: 12px;
    text-align: left;
}

th {
    background-color: #f8f9fa;
    font-weight: 700;
    color: #555;
}

tr:nth-child(even) {
    background-color: #fefefe;
}

tr:hover {
    background-color: #f0f0f0;
}

.action-buttons a, .action-buttons button {
    display: inline-block;
    padding: 8px 12px;
    margin: 5px 2px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9em;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s ease;
}

.action-buttons a.edit {
    background-color: #ffc107;
    color: #333;
}
.action-buttons a.edit:hover {
    background-color: #e0a800;
}

.action-buttons a.manage {
    background-color: #17a2b8;
    color: white;
}
.action-buttons a.manage:hover {
    background-color: #138496;
}

.action-buttons a.view-tickets {
    background-color: #28a745;
    color: white;
}
.action-buttons a.view-tickets:hover {
    background-color: #218838;
}

.action-buttons button.validate {
    background-color: #28a745;
    color: white;
}
.action-buttons button.validate:hover {
    background-color: #218838;
}

.action-buttons button.revoke {
    background-color: #dc3545;
    color: white;
}
.action-buttons button.revoke:hover {
    background-color: #c82333;
}

.ticket-status.validated {
    color: #28a745;
    font-weight: 600;
}
.ticket-status.revoked {
    color: #dc3545;
    font-weight: 600;
}
.ticket-status.pending {
    color: #ffc107;
    font-weight: 600;
}

.free-price-info {
    font-style: italic;
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}

/* Event cards on public events page */
.event-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.event-card {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    text-align: left;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.event-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.event-card img {
    width: 100%;
    height: 360px;
    object-fit: cover;
    display: block;
}

.event-card-content {
    padding: 20px;
}

.event-card-content h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
    font-size: 1.5em;
}

.event-card-content p {
    margin-bottom: 8px;
    color: #666;
    font-size: 0.95em;
}

.event-card-content .price {
    font-weight: 700;
    color: #28a745;
    font-size: 1.1em;
    margin-top: 15px;
    margin-bottom: 15px;
}

.event-card-content .view-event-button {
    display: block;
    width: calc(100% - 20px);
    padding: 10px;
    background-color: #007bff;
    color: white;
    text-align: center;
    border-radius: 8px;
    text-decoration: none;
    margin-top: 15px;
    transition: background-color 0.3s ease;
}

.event-card-content .view-event-button:hover {
    background-color: #0056b3;
}

/* Specific styles for ticket_details.php (PDF-like display) */
.ticket-details-container {
    max-width: 600px;
    background-color: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
    margin: 50px auto;
    border: 2px dashed #007bff;
}

.ticket-details-container h2 {
    color: #007bff;
    font-size: 2.2em;
    margin-bottom: 15px;
}

.ticket-details-container h3 {
    color: #333;
    font-size: 1.8em;
    margin-bottom: 10px;
}

.ticket-details-container p {
    font-size: .9em;
    margin-bottom: 10px;
    color: #555;
}

.ticket-details-container .ticket-uuid {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #888;
    margin-top: 20px;
    word-break: break-all;
}

.ticket-details-container .ticket-number {
    font-size: 2em;
    font-weight: 700;
    color: #28a745;
    margin-top: 20px;
    margin-bottom: 20px;
}

.ticket-details-container .qr-code {
    margin-top: 25px;
    margin-bottom: 25px;
}
.ticket-details-container .qr-code img {
    max-width: 150px;
    height: auto;
    border: 1px solid #eee;
    padding: 5px;
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .container.large {
        max-width: 95%;
        padding: 15px;
    }
    .event-list {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }
    th, td {
        padding: 8px;
        font-size: 0.9em;
    }
    .action-buttons a, .action-buttons button {
        padding: 6px 10px;
        font-size: 0.8em;
    }
}

@media (max-width: 600px) {
    .container {
        margin: 20px;
        padding: 20px;
    }
    .dashboard-nav {
        flex-direction: column;
        align-items: center;
    }
}


/* Dropdown Button Specific Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-button {
    background-color: #f8f9fa;
    color: #007bff;
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
    border: 1px solid #007bff;
    cursor: pointer; /* Add pointer cursor to indicate it's clickable */
}

.dropdown-button:hover {
    background-color: #e2e6ea;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 8px;
    overflow: hidden; /* Ensures rounded corners on children */
    top: 100%; /* Position below the button */
    left: 0;
    margin-top: -1px; /* Small space between button and dropdown */
}

.dropdown-content a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    font-weight: 400; /* Reset font-weight for dropdown items */
    border: none; /* Remove border from dropdown items */
    border-radius: 0; /* Remove border-radius from dropdown items */
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
    color: #007bff;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Ensure dropdown doesn't break flex layout on smaller screens */
@media (max-width: 600px) {
    .dropdown {
        width: 100%; /* Take full width in column layout */
        text-align: center;
    }

    .dropdown-button {
        width: calc(100% - 20px); /* Adjust for padding */
        display: block; /* Make the button a block element */
        margin: auto; /* Center the button */
    }

    .dropdown-content {
        width: 100%; /* Full width dropdown */
        left: 0;
        right: 0;
    }
}
/* Responsive Table: Card View for Mobile */
@media screen and (max-width: 768px) { /* Adjust breakpoint as needed */
    table {
        border: 0; /* Remove main table border */
    }

    table thead {
        display: none; /* Hide table headers (thead) on mobile */
    }

    table,
    table tbody,
    table tr,
    table td {
        display: block; /* Make table elements behave like blocks */
        /*width: 100%;  Ensure they take full width */
    }

    table tr {
        margin-bottom: 15px; /* Add space between "cards" (rows) */
        border: 1px solid #ddd; /* Add a border to define each card */
        border-radius: 8px; /* Rounded corners for the cards */
        box-shadow: 0 2px 8px rgba(0,0,0,0.05); /* Subtle shadow */
        padding: 10px; /* Padding inside the card */
    }

    table td {
        border-bottom: 1px solid #eee; /* Add a separator between "fields" within a card */
        padding: 10px !important; /* Ensure padding within td */
        text-align: right !important; /* Align data to the right */
        position: relative; /* For data-label positioning */
    }

    table td:last-child {
        border-bottom: 0; /* No border for the last item in a card */
        padding-bottom: 0;
    }

    /* Display the data-label as a pseudo-element */
    table td::before {
        content: attr(data-label); /* Use the content from data-label attribute */
        float: left; /* Position label to the left */
        font-weight: 600; /* Make label bold */
        text-transform: uppercase; /* Optional: uppercase labels */
        color: #555;
        margin-right: 10px; /* Space between label and value */
    }

    /* Adjust specific elements within the card view */
    table .action-buttons {
        text-align: center !important; /* Center action buttons */
        padding-top: 15px !important; /* Add space above buttons */
    }
    table .action-buttons a,
    table .action-buttons button {
        margin: 5px; /* Adjust button margins */
        display: inline-block; /* Ensure buttons stay side-by-side if they fit */
        width: auto; /* Allow buttons to size based on content */
    }
}

/* Search Bar Styling */
.search-container {
    margin-bottom: 20px; /* Space below the search bar */
    text-align: center; /* Center the input if its max-width makes it smaller than its container */
}

#tableSearchBar, #tableSearchBar2 {
    width: calc(100% - 20px); /* Matches your existing input width calculation (100% - padding) */
    max-width: 400px; /* Limits the width on larger screens for better aesthetics */
    padding: 12px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

#tableSearchBar:focus, #tableSearchBar2:focus {
    border-color: #007bff;
    outline: none;
}

/* =========================================================
   Global responsive refinements (apply to every admin page)
   ========================================================= */
/* Let wide content containers use the screen on large displays */
.container.large { max-width: 1200px; }

/* Tables never break the layout — they scroll horizontally on small screens.
   Wrap tables in .table-responsive where possible; this also catches bare tables. */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 1024px) {
    .container, .container.large { max-width: 100%; }
}

@media (max-width: 768px) {
    body { margin: 0; }
    .container, .container.large {
        margin: 0 0 80px; border-radius: 0; padding: 18px 14px;
        box-shadow: none; max-width: 100%;
    }
    h2 { font-size: 1.4rem; margin-bottom: 18px; }

    /* Any table scrolls sideways instead of overflowing the page */
    table { display: block; width: 100%; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

    /* Buttons go full width & stack so they're tap-friendly */
    .button, button.button, a.button, input[type="submit"], .button-filter {
        width: 100%; text-align: center; box-sizing: border-box;
    }

    /* Inline forms / filter bars stack */
    .form-inline { flex-direction: column; align-items: stretch; }
    .form-inline .form-group { width: 100%; justify-content: space-between; }

    /* Legacy in-page dashboard nav (kept as a fallback) wraps */
    .dashboard-nav { flex-direction: column; align-items: stretch; gap: 8px; }
    .dashboard-nav .dropdown, .dashboard-nav .dropdown-button { width: 100%; }
    .dashboard-nav .dropdown-content { position: static; box-shadow: none; }
}