/* File: style.css (Tema Dark Space / Card Design) */
:root {
    color-scheme: dark;
    --bg-main: #0B101E; /* Blu notte profondo */
    --bg-card: #1E293B; /* Blu ardesia scuro per i form e contenitori */
    --bg-table-alt: #111827; /* Grigio scuro per le righe alternate */
    --text-main: #E2E8F0; /* Grigio chiaro per il testo */
    --text-muted: #94A3B8; /* Testo secondario */
    --accent-color: #38BDF8; /* Ciano stile sci-fi */
    --accent-hover: #0EA5E9; /* Ciano scuro */
    --border-color: #334155; /* Bordi scuri */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-main);
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--bg-main);
}

html { scroll-behavior: smooth; }

h1, h2 {
    color: var(--accent-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.titolo_podcast { color: var(--accent-color); font-style: italic; }

/* ================= TABLES & CARDS ================= */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    table-layout: fixed;
    background-color: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
    word-break: break-word;
}

thead { background-color: #0F172A; }
thead a { color: var(--accent-color); text-decoration: none; font-weight: bold; }
thead a:hover { color: #fff; }
thead small a { color: #94A3B8; font-weight: normal; }

tbody tr:nth-child(even) { background-color: var(--bg-table-alt); }
tbody tr:hover { background-color: #2e3b4e; }

a { color: var(--accent-color); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent-hover); }

/* ================= MACRO-AREE DESIGN ================= */
.site-title { font-size: 1.15em; font-weight: bold; margin-bottom: 8px; color: #fff; }
.site-badges { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.badge { padding: 4px 8px; border-radius: 4px; font-size: 0.8em; font-weight: bold; background: #334155; color: #fff; }
.badge.type { background: #3B82F6; }
.badge.users { background: #10B981; }

.activity-row { margin-bottom: 5px; font-size: 0.95em; }
.activity-label { color: var(--accent-color); font-size: 0.85em; display: block; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 5px;}
.activity-meta { font-size: 0.85em; color: var(--text-muted); background: #0F172A; padding: 4px 8px; border-radius: 4px; display: inline-block; margin-top: 5px; }

.anno-box { background: rgba(0,0,0,0.2); padding: 8px; border-radius: 4px; margin-bottom: 8px; font-size: 0.9em; border-left: 3px solid var(--accent-color); }
.anno-box strong { color: var(--accent-color); display: block; font-size: 0.85em; text-transform: uppercase; margin-bottom: 2px;}

/* ================= BUTTONS ================= */
.button, .button-edit, .button-delete, .button-cancel, .button-save, 
.button-add-op, .button-edit-op, .button-view-message, .button-message, 
.button-copy, .button-topic, .button-hashtags, .button-history, 
.button-commit, .button-random, .button-mark-sent, .button-hide, 
.button-show, .button-copy-hashtag, .button-copy-all, .button-settings, 
.button-mark-verified {
    display: inline-block;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    text-align: center;
    font-size: 14px;
    margin: 2px 0;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s ease;
    font-weight: 500;
}

.button:hover, .button-edit:hover, .button-delete:hover, .button-save:hover { filter: brightness(1.1); }

/* Colori pulsanti */
.button { background-color: #10B981; }
.button-edit { background-color: #F59E0B; }
.button-delete { background-color: #EF4444; }
.button-cancel { background-color: #64748B; }
.button-save { background-color: #3B82F6; }
.button-mark-verified { background-color: #10B981; margin-left: auto !important; }
.button-add-op { background-color: #8B5CF6; }
.button-edit-op { background-color: #14B8A6; }
.button-message { background-color: #475569; }
.button-copy { background-color: #0EA5E9; }
.button-topic { background-color: #A855F7; }
.button-hashtags { background-color: #06B6D4; }
.button-history { background-color: #F97316; }
.button-commit { background-color: #334155; }
.button-random { background-color: #EAB308; color: #1E293B; font-weight: bold; }
.button-mark-sent { background-color: #F97316; }
.button-hide { background-color: #64748B; }
.button-show { background-color: #10B981; }
.button-copy-hashtag { background-color: #A855F7; }
.button-copy-all { background-color: #14B8A6; }
.button-settings { background-color: #64748B; }
.button-go-link { background-color: #4F46E5; }
.button-facebook-profile { background-color: #D946EF; }
.button-messages { background-color: #A855F7; }
.button-view-message { background-color: #EAB308; color: #1E293B;}
.button-disabled { background-color: #475569; cursor: not-allowed; opacity: 0.5; }

.icon-button {
    width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; padding: 0;
}

.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; justify-content: flex-start;}
.actions form { margin: 0; }
.actions .icon-button { width: 36px; flex-grow: 0; }

hr { border: 0; height: 1px; background: var(--border-color); margin: 40px 0; }

/* ================= FORMS ================= */
.add-form {
    display: flex; flex-direction: column; gap: 12px; background: var(--bg-card);
    padding: 20px; border-radius: 8px; border: 1px solid var(--border-color);
}
.add-form input, .add-form textarea, .add-form select,
.inline-form input, .inline-form textarea, .inline-form select {
    padding: 10px; border: 1px solid var(--border-color); border-radius: 6px;
    font-size: 16px; background-color: var(--bg-main); color: var(--text-main);
}
.add-form input:focus, .add-form textarea:focus, .add-form select:focus { outline: none; border-color: var(--accent-color); }
.add-form button {
    padding: 12px; background-color: var(--accent-color); color: #0B101E; border: none;
    border-radius: 6px; font-size: 16px; font-weight: bold; cursor: pointer;
}
.add-form button:hover { background-color: var(--accent-hover); }

/* Form in Linea */
.inline-form-row { background-color: #1E293B !important; }
.inline-form { padding: 15px; display: flex; flex-direction: column; gap: 12px; }
.inline-form h4 { margin: 0 0 10px 0; color: var(--accent-color); }
.inline-form textarea { min-height: 80px; }
.inline-form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form-actions .button-save, .inline-form-actions .button-cancel, .inline-form-actions .button-mark-verified { width: auto; }

/* ================= LAYOUT & UTILS ================= */
.header-container {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
    border-bottom: 2px solid var(--border-color); padding-bottom: 15px; margin-bottom: 25px; gap: 15px;
}
.header-container h1 { border-bottom: none; padding-bottom: 0; margin: 0; color: #fff; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.message { padding: 15px; margin-top: 10px; border-radius: 6px; font-weight: bold; text-align: center; }
.message.success { background-color: rgba(16, 185, 129, 0.2); color: #34D399; border: 1px solid #10B981; }
.message.error { background-color: rgba(239, 68, 68, 0.2); color: #F87171; border: 1px solid #EF4444; }

.controls-container { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 20px; align-items: center; }
.search-form, .filter-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-form input[type="search"], .filter-form select { background-color: var(--bg-card); color: var(--text-main); }
.view-toggle { margin-left: auto; display: flex; gap: 10px; }

/* Tooltips e Badge */
.status-dot { height: 12px; width: 12px; border-radius: 50%; display: inline-block; margin-right: 8px; vertical-align: middle; }
.dot-ok { background-color: #10B981; }
.dot-nook { background-color: #EF4444; }
.dot-incerto { background-color: #F97316; }
.dot-sospeso, .dot-eliminato { background-color: #EAB308; }

.riga-nascosta { opacity: 0.4; filter: grayscale(100%); }
.riga-non-usare { background-color: rgba(239, 68, 68, 0.1) !important; border-left: 4px solid #EF4444; }

/* Hashtag Suggeriti */
.suggestion-button { background-color: var(--bg-main); color: var(--text-main); border: 1px solid var(--border-color); padding: 4px 8px; border-radius: 4px; font-size: 12px; cursor: pointer;}
.suggestion-button:hover { background-color: var(--border-color); }
.suggestion-button.active { background-color: var(--accent-color) !important; color: #000 !important; font-weight: bold;}

/* Storico Rapido AJAX */
.storico-container-row { display: none; }
.storico-container-row.storico-visible { display: table-row; }
.storico-content-wrapper { padding: 15px; border-bottom: 1px solid #F97316; background: #0F172A;}
.sub-table { background-color: transparent; box-shadow: none;}
.sub-table thead { background-color: rgba(255,255,255,0.05); }
.toggle-storico-btn.active { background-color: #C2410C; box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); }

/* ================= MOBILE RESPONSIVE (CARD DESIGN) ================= */
@media screen and (max-width: 768px) {
    body { padding: 10px; }
    .desktop-header { display: none; }
    .mobile-sort-controls { display: block; }
    .controls-container { flex-direction: column; align-items: stretch; }
    
    table { background-color: transparent; box-shadow: none; display: block; border: none; }
    tbody { display: block; width: 100%; }
    
    tr {
        display: flex; flex-direction: column; margin-bottom: 20px; border: 1px solid var(--border-color);
        background-color: var(--bg-card) !important; border-radius: 8px; overflow: hidden;
    }
    
    /* Le celle non hanno più il padding a sinistra forzato, diventano blocchi naturali */
    td {
        display: block; text-align: left; padding: 15px; border-bottom: 1px solid rgba(255,255,255,0.05);
        width: 100% !important; box-sizing: border-box;
    }
    td:last-child { border-bottom: none; background-color: rgba(0,0,0,0.2); }
    
    /* Nascondiamo i vecchi data-label visto che le macro-aree sono autoesplicative */
    td::before { display: none; }
    
    .actions { justify-content: flex-start; }
    
    .storico-container-row.storico-visible { display: flex; }
}