/* =====================================================
   WP Ticketing — Mobile First Responsive
   ===================================================== */

.wpt-ticket-list,
.wpt-create-ticket,
.wpt-ticket-detail,
.wpt-calendar-wrapper,
.wpt-login-form,
.wpt-logged-in {
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
}

/* ---------- Form ---------- */
.wpt-create-ticket label { display: block; margin: 0 0 4px; font-weight: 600; }
.wpt-create-ticket input,
.wpt-create-ticket textarea,
.wpt-create-ticket select,
.wpt-ticket-actions select,
.wpt-modal-content input,
.wpt-modal-content textarea,
.wpt-modal-content select,
.wpt-login-form input[type="text"],
.wpt-login-form input[type="password"],
.wpt-edit-desc-container textarea,
.wpt-log-form-fields input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 11px 12px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
}
.wpt-create-ticket textarea { resize: vertical; min-height: 120px; }

/* ---------- Login Form ---------- */
.wpt-login-form { max-width: 400px; margin: 0 auto; background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.wpt-login-form h3 { margin-top: 0; margin-bottom: 15px; text-align: center; }
.wpt-login-form p { margin-bottom: 15px; }
.wpt-login-form label { display: block; margin-bottom: 4px; font-weight: bold; }
.wpt-login-form .login-remember { display: flex; align-items: center; gap: 8px; }
.wpt-login-form input[type="checkbox"] { width: auto; }
.wpt-login-form .button { width: 100%; padding: 10px; font-size: 16px; cursor: pointer; }
.wpt-login-links { text-align: center; font-size: 14px; margin-top: 10px; }

/* ---------- Bottoni touch-friendly ---------- */
.wpt-create-ticket button,
.wpt-ticket-actions button,
.wpt-table .button,
#wpt-save-event,
#wpt-cancel-event,
.wpt-logged-in .button,
.wpt-filters button,
.wpt-filters .button,
.wpt-edit-desc-container button,
.wpt-save-log,
.wpt-cancel-log {
    min-height: 44px;
    padding: 10px 18px;
    font-size: 15px;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1.2;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

/* ---------- Barra dei Filtri ---------- */
.wpt-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
    align-items: center;
}
.wpt-filters select,
.wpt-filters input[type="date"] {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 15px;
    background: #fff;
    min-width: 150px;
}

/* ---------- Tabella ticket ---------- */
.wpt-ticket-list { margin: 15px 0; }
.wpt-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.wpt-table th, .wpt-table td { padding: 10px 12px; border-bottom: 1px solid #e5e5e5; text-align: left; vertical-align: middle; }
.wpt-table th { background: #f7f7f7; font-weight: 600; }

/* ---------- Paginazione ---------- */
.wpt-pagination { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; justify-content: center; align-items: center; }
.wpt-pagination .page-numbers { padding: 8px 14px; border: 1px solid #ccc; border-radius: 6px; text-decoration: none; color: #333; background: #fff; font-size: 15px; }
.wpt-pagination .page-numbers.current { background: #3498db; color: #fff; border-color: #3498db; font-weight: bold; }
.wpt-pagination .page-numbers:hover:not(.current) { background: #f0f0f0; }

/* ---------- Badge stato ---------- */
.wpt-status { display: inline-block; padding: 3px 9px; border-radius: 12px; color: #fff; font-size: 12px; line-height: 1.4; white-space: nowrap; }
.wpt-status-new         { background: #3498db; }
.wpt-status-viewed      { background: #95a5a6; }
.wpt-status-in_progress { background: #f39c12; }
.wpt-status-paused      { background: #e67e22; }
.wpt-status-resolved    { background: #27ae60; }
.wpt-status-closed      { background: #7f8c8d; }

/* ---------- Messaggi ---------- */
.wpt-success { background:#d4edda; color:#155724; padding:12px; border-radius:6px; margin:12px 0; }
.wpt-error   { background:#f8d7da; color:#721c24; padding:12px; border-radius:6px; margin:12px 0; }

/* ---------- Dettaglio ticket ---------- */
.wpt-ticket-detail { margin: 20px 0; }
.wpt-ticket-content { background:#fafafa; padding:15px; border:1px solid #eee; border-radius:6px; margin:15px 0; overflow-wrap: break-word; word-wrap: break-word; }
.wpt-ticket-actions { background:#f1f8ff; padding:15px; border-left:4px solid #3498db; margin:15px 0; border-radius: 0 6px 6px 0; }
.wpt-ticket-actions p { margin: 10px 0; }
.wpt-ticket-actions label { display: block; margin-bottom: 6px; font-weight: 600; }

/* ---------- Pannello Modifica Descrizione ---------- */
.wpt-edit-desc-container { margin: 15px 0; background: #fff8e5; border: 1px solid #ffeeba; border-radius: 6px; padding: 10px 15px; }
.wpt-edit-desc-container summary { cursor: pointer; font-weight: 600; color: #856404; padding: 5px 0; }
.wpt-edit-desc-container summary:hover { color: #533f03; }

/* ---------- Ore di Lavorazione ---------- */
.wpt-work-logs-container {
    margin: 25px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.03);
}
.wpt-work-logs-container h3 { margin-top: 0; font-size: 1.2rem; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.wpt-logs-table th { background: #f8f9fa; font-size: 14px; }
.wpt-logs-table td { font-size: 14px; }
.wpt-total-hours {
    text-align: right;
    font-size: 1.1rem;
    margin-top: 10px;
    color: #2c3e50;
}
.wpt-add-log-form {
    margin-top: 25px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px dashed #ccc;
    border-radius: 8px;
}
.wpt-add-log-form h4 { margin-top: 0; margin-bottom: 10px; color: #333; }
.wpt-log-form-fields {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.wpt-log-form-fields input[type="date"] { width: auto; min-width: 130px; }
.wpt-log-form-fields input[type="number"] { width: 100px; }
.wpt-log-form-fields input[type="text"] { flex: 1; min-width: 200px; }

/* ---------- Calendario ---------- */
.wpt-calendar-wrapper #wpt-calendar { max-width: 100%; margin: 20px 0; background: #fff; padding: 8px; border-radius: 6px; box-sizing: border-box; }
.fc .fc-toolbar-title { font-size: 1.2rem; }
.fc .fc-button { padding: 6px 10px; }

/* ---------- Modale evento ---------- */
#wpt-event-modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 99999; padding: 16px; box-sizing: border-box; }
.wpt-modal-content { background:#fff; padding:20px; border-radius:10px; width: 420px; max-width: 100%; box-sizing: border-box; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.wpt-modal-content h4 { margin-top: 0; }
.wpt-modal-content button { min-height: 44px; padding: 10px 16px; margin-right: 6px; }

/* =====================================================
   MOBILE — fino a 768px
   ===================================================== */
@media (max-width: 768px) {
    .wpt-filters { flex-direction: column; align-items: stretch; }
    .wpt-filters select,
    .wpt-filters input[type="date"],
    .wpt-filters button,
    .wpt-filters .button { width: 100%; }

    .wpt-table thead { display: none; }
    .wpt-table, .wpt-table tbody, .wpt-table tr, .wpt-table td { display: block; width: 100%; }

    .wpt-table tr { border: 1px solid #e2e2e2; border-radius: 8px; margin-bottom: 12px; padding: 10px 12px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
    .wpt-table td { padding: 6px 0; border: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
    .wpt-table td::before { content: attr(data-label); font-weight: 600; color: #555; flex: 0 0 auto; }
    .wpt-table td[data-label=""]::before { content: none; }
    .wpt-table td.wpt-actions-cell { justify-content: flex-end; padding-top: 10px; gap: 5px; }
    .wpt-table td.wpt-actions-cell .button { width: auto; flex: 1; text-align: center; font-size: 13px; padding: 8px; }

    .wpt-ticket-actions p { display: flex; flex-direction: column; gap: 8px; }
    .wpt-ticket-actions button { width: 100%; }

    /* Ore mobile */
    .wpt-log-form-fields { flex-direction: column; align-items: stretch; }
    .wpt-log-form-fields input { width: 100% !important; }
    .wpt-save-log, .wpt-cancel-log { width: 100%; margin: 5px 0 0 0 !important; }

    .fc .fc-toolbar { flex-direction: column; gap: 8px; align-items: stretch; }
    .fc .fc-toolbar-chunk { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; }
    .fc .fc-button { font-size: 13px; padding: 6px 8px; }
    .fc .fc-toolbar-title { font-size: 1.05rem; text-align: center; }

    .wpt-create-ticket button[type="submit"] { width: 100%; }

    .wpt-modal-content { padding: 16px; }
    .wpt-modal-content button { width: 100%; margin: 6px 0 0 0; }

    .wpt-ticket-detail h2, .wpt-ticket-list h3 { font-size: 1.15rem; line-height: 1.35; }
    
    .wpt-pagination { justify-content: center; }
    .wpt-pagination .page-numbers { padding: 6px 10px; font-size: 14px; }
}

/* =====================================================
   VERY SMALL — fino a 480px
   ===================================================== */
@media (max-width: 480px) {
    .wpt-table tr { padding: 8px 10px; }
    .wpt-table td { font-size: 14px; }
    .wpt-status { font-size: 11px; padding: 2px 8px; }
    .wpt-ticket-detail h2 { font-size: 1.05rem; }
}