/**
 * Karma Memorials Admin CSS
 * 
 * Stili per l'interfaccia amministrativa
 */

/* Metabox personalizzati */
.karma-memorial-meta-box {
    margin: 20px 0;
}

.karma-memorial-meta-box .form-table th {
    width: 200px;
    padding: 20px 10px 20px 0;
    vertical-align: top;
}

.karma-memorial-meta-box .form-table td {
    padding: 15px 10px;
}

.karma-memorial-meta-box .form-table input[type="text"],
.karma-memorial-meta-box .form-table input[type="email"],
.karma-memorial-meta-box .form-table input[type="date"],
.karma-memorial-meta-box .form-table input[type="time"],
.karma-memorial-meta-box .form-table input[type="number"],
.karma-memorial-meta-box .form-table textarea {
    width: 100%;
    max-width: 400px;
}

.karma-memorial-meta-box .form-table input[type="date"],
.karma-memorial-meta-box .form-table input[type="time"] {
    max-width: 200px;
}

.karma-memorial-meta-box .form-table input[type="number"] {
    max-width: 100px;
}

/* Pulsante geocodifica */
#geocode_address {
    margin: 10px 0;
}

#geocode_address:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Anteprima mappa */
#map_preview {
    height: 200px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#map_preview p {
    margin: 0;
    color: #666;
    text-align: center;
}

/* Nascondi attribuzione OpenStreetMap nelle mappe admin */
.leaflet-control-attribution {
    display: none !important;
}

/* Stili per le mappe admin */
#karma-memorial-map-preview,
#karma-memorial-map-preview-ricorrenza {
    width: 100% !important;
    height: 300px !important;
    min-height: 300px !important;
}

/* Messaggi commemorativi */
.memorial-messages-summary {
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.memorial-messages-summary ul {
    margin: 10px 0;
    padding-left: 20px;
}

.memorial-messages-summary li {
    margin: 5px 0;
}

/* Validazione errori */
.form-table input.error,
.form-table textarea.error {
    border-color: #dc3232;
    box-shadow: 0 0 0 1px #dc3232;
}

/* Gestione manifesto funebre */
.funeral-poster-upload {
    margin: 10px 0;
}

.poster-preview {
    margin: 15px 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.poster-preview img {
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.upload-poster {
    margin-right: 10px;
}

.remove-poster {
    margin-top: 10px;
}

/* Stili per le località */
.location-form-section {
    background: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
}

.location-form-section h3 {
    margin-top: 0;
    color: #23282d;
}

.location-form .form-table th {
    width: 150px;
}

/* Responsive */
@media screen and (max-width: 782px) {
    .karma-memorial-meta-box .form-table th,
    .karma-memorial-meta-box .form-table td {
        display: block;
        width: 100%;
        padding: 10px 0;
    }
    
    .karma-memorial-meta-box .form-table input[type="text"],
    .karma-memorial-meta-box .form-table input[type="email"],
    .karma-memorial-meta-box .form-table input[type="date"],
    .karma-memorial-meta-box .form-table input[type="time"],
    .karma-memorial-meta-box .form-table input[type="number"],
    .karma-memorial-meta-box .form-table textarea {
        max-width: 100%;
    }
}

/* Stili per i tab admin */
.karma-memorials-admin .nav-tab-wrapper {
    margin-bottom: 20px;
    border-bottom: 1px solid #ccc;
}

.karma-memorials-admin .nav-tab {
    margin-right: 5px;
    margin-bottom: -1px;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-bottom: none;
    background: #f1f1f1;
    text-decoration: none;
    color: #555;
    font-weight: 600;
    cursor: pointer;
}

.karma-memorials-admin .nav-tab:hover {
    background: #e5e5e5;
    color: #23282d;
}

.karma-memorials-admin .nav-tab-active {
    background: #fff;
    border-bottom: 1px solid #fff;
    color: #23282d;
}

.karma-memorials-admin .tab-content {
    display: none;
    padding: 20px;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
}

.karma-memorials-admin .tab-content.active {
    display: block;
}

/* Dashboard stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.stat-card h3 {
    margin: 0 0 10px 0;
    color: #23282d;
    font-size: 24px;
}

.stat-card p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Recent items */
.dashboard-recent,
.dashboard-messages {
    background: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
}

.dashboard-recent h2,
.dashboard-messages h2 {
    margin-top: 0;
    color: #23282d;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.recent-item {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.recent-item:last-child {
    border-bottom: none;
}

.recent-item h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
}

.recent-item p {
    margin: 0;
    color: #666;
    font-size: 12px;
}

/* ==========================================================================
   Color Picker Styles - Modernized with WordPress Native Color Pickers
   ========================================================================== */

.color-picker-wrapper {
    margin-bottom: 10px;
}

.color-picker-wrapper .wp-color-picker {
    width: 100px;
}

/* WordPress Color Picker Integration */
.wp-color-result {
    border: 2px solid #ddd !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.wp-color-result:hover {
    border-color: #007cba !important;
}

.wp-picker-container {
    display: inline-block;
}

.wp-picker-container .wp-color-result {
    margin-right: 10px;
}

/* Reset Colors Button */
.reset-colors-wrapper {
    margin-top: 15px;
}

.reset-colors-wrapper .button {
    background: #f7f7f7;
    border: 1px solid #ccc;
    color: #555;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-colors-wrapper .button:hover {
    background: #eee;
    border-color: #999;
    color: #333;
}

.reset-colors-wrapper .description {
    margin-top: 8px;
    color: #666;
    font-style: italic;
}

/* ==========================================================================
   Header Background Image Management
   ========================================================================== */

.header-background-image-wrapper {
    margin: 15px 0;
}

.image-preview {
    margin: 15px 0;
    text-align: center;
}

.image-preview img {
    border: 2px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.image-preview img:hover {
    transform: scale(1.02);
}

.no-image-placeholder {
    border: 2px dashed #ccc !important;
    background: #f9f9f9 !important;
    color: #666 !important;
}

/* FORZA RIMOZIONE PLACEHOLDER TITOLO RICORRENZE */
body.post-type-ricorrenza #title::placeholder {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

body.post-type-ricorrenza #title::-webkit-input-placeholder {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

body.post-type-ricorrenza #title::-moz-placeholder {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

body.post-type-ricorrenza #title:-ms-input-placeholder {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Stili per campi obbligatori ricorrenze */
.post-type-ricorrenza .form-field label:after {
    content: "";
}

.post-type-ricorrenza .form-field.required label:after {
    content: " *";
    color: #d63638;
    font-weight: bold;
}

.post-type-ricorrenza .form-field.required input:invalid,
.post-type-ricorrenza .form-field.required textarea:invalid {
    border-color: #d63638;
}

.post-type-ricorrenza .form-field.required input:valid,
.post-type-ricorrenza .form-field.required textarea:valid {
    border-color: #00a32a;
}

/* Evidenziazione campi mancanti */
.highlight-missing {
    border: 2px solid #d63638 !important;
    background-color: #fef2f2 !important;
    animation: pulse-red 1s ease-in-out 3;
}

@keyframes pulse-red {
    0% { background-color: #fef2f2; }
    50% { background-color: #fee2e2; }
    100% { background-color: #fef2f2; }
}

/* Evidenziazione per la sidebar dei tipi ricorrenza */
#karmme_tipo_ricorrenzachecklist.highlight-missing {
    border: 2px solid #d63638 !important;
    background-color: #fef2f2 !important;
    border-radius: 4px !important;
    padding: 10px !important;
}

/* Messaggio per tipi ricorrenza nella sidebar */
.ricorrenza-types-warning {
    color: #d63638;
    font-weight: bold;
    margin-top: 10px;
    padding: 10px;
    background: #fef2f2;
    border: 1px solid #d63638;
    border-radius: 4px;
    display: none;
}
    font-size: 14px !important;
    font-style: italic !important;
}

.image-controls {
    margin: 15px 0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.image-controls .button {
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-controls .button-secondary {
    background: #f7f7f7;
    border: 1px solid #ccc;
    color: #555;
}

.image-controls .button-secondary:hover {
    background: #eee;
    border-color: #999;
    color: #333;
}

.image-controls .button-link-delete {
    background: none;
    border: none;
    color: #a00;
    text-decoration: underline;
    padding: 8px 0;
}

.image-controls .button-link-delete:hover {
    color: #dc3232;
    text-decoration: none;
}

/* Responsive adjustments */
@media (max-width: 782px) {
    .image-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .image-controls .button {
        text-align: center;
    }
}

/* ==========================================================================
   Overlay Opacity Slider Styles
   ========================================================================== */
.overlay-opacity-wrapper {
    margin: 15px 0;
}

.opacity-slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.opacity-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0073aa;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.opacity-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0073aa;
    cursor: none;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.opacity-value {
    font-weight: bold;
    color: #0073aa;
    min-width: 50px;
    text-align: center;
}

/* ==========================================================================
   Plugin Action Links Styles
   ========================================================================== */

/* Link Upgrade nelle liste plugin */
.upgrade-link {
    color: #ff6b35 !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    background: linear-gradient(135deg, #ff6b35, #f7931e) !important;
    color: white !important;
    transition: all 0.3s ease !important;
}

.upgrade-link:hover {
    background: linear-gradient(135deg, #e55a2b, #e68a1a) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3) !important;
    color: white !important;
}

/* Link Impostazioni */
.plugin-action-links a[href*="edit.php?post_type=karmme_memoriale"] {
    color: #0073aa !important;
    font-weight: 500 !important;
}

.plugin-action-links a[href*="edit.php?post_type=karmme_memoriale"]:hover {
    color: #005a87 !important;
    text-decoration: underline !important;
}

/* ==========================================================================
   Maps and Geocoding Styles
   ========================================================================== */

/* Messaggi di feedback per geocodifica */
.karma-memorial-message {
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 4px;
    border-left: 4px solid;
    font-size: 13px;
    line-height: 1.4;
}

.karma-memorial-success {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.karma-memorial-error {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.karma-memorial-info {
    background-color: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* Pulsante geocodifica */
.geocode-address-btn {
    margin-top: 5px !important;
}

.geocode-address-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Campi coordinate */
#km_latitude,
#km_longitude {
    background-color: #f9f9f9;
    color: #666;
}

/* Responsive per mappe */
@media (max-width: 782px) {
    .geocode-address-btn {
        width: 100%;
        margin-top: 10px !important;
    }
}

/* ==========================================================================
   Message Management Button Styles
   ========================================================================== */

/* Pulsante "Rimetti in Moderazione" */
.button-warning {
    background: #f0b849 !important;
    border-color: #dba617 !important;
    color: #fff !important;
}

.button-warning:hover {
    background: #e5a726 !important;
    border-color: #c89500 !important;
}

/* Pulsante "Elimina" */
.button-link-delete {
    color: #a00 !important;
    border-color: #a00 !important;
    background: transparent !important;
}

.button-link-delete:hover {
    color: #dc3232 !important;
    border-color: #dc3232 !important;
    background: #dc3232 !important;
    color: #fff !important;
}

/* Spaziatura tra pulsanti azioni */
.column-actions .button {
    margin-right: 5px;
    margin-bottom: 3px;
}

.column-actions .button:last-child {
    margin-right: 0;
}

/* Responsive per pulsanti azioni */
@media (max-width: 782px) {
    .column-actions .button {
        display: block;
        width: 100%;
        margin-right: 0;
        margin-bottom: 5px;
        text-align: center;
    }
}

/* ==========================================================================
   Message Details Modal Styles
   ========================================================================== */

/* Modal overlay */
.modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

/* Modal content */
.modal-content {
    background-color: #fefefe;
    margin: 5% auto !important;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    position: relative;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
}

/* Close button */
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
}

/* Modal title */
.modal h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #23282d;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

/* Message details table */
.message-details .form-table {
    width: 100%;
    border-collapse: collapse;
}

.message-details .form-table th {
    width: 30%;
    text-align: left;
    padding: 8px 12px;
    background-color: #f9f9f9;
    border: 1px solid #e1e1e1;
    font-weight: 600;
}

.message-details .form-table td {
    padding: 8px 12px;
    border: 1px solid #e1e1e1;
}

/* Full message text */
.message-full-text {
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    line-height: 1.6;
}

/* Status badges in modal */
.modal .status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Responsive modal */
@media (max-width: 782px) {
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 15px;
    }
    
    .message-details .form-table th,
    .message-details .form-table td {
        display: block;
        width: 100%;
        text-align: left;
    }
    
    .message-details .form-table th {
        background-color: #f0f0f0;
        margin-top: 10px;
    }
}