/* ==========================================
   BACKOFFICE.PHP (NON TOCCARE)
   ========================================== */
body {
    background-color: #1a222c;
    color: #e2e8f0;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    padding: 20px;
    margin: 0;
}

.container { max-width: 1200px; margin: 0 auto; }

h1 { text-align: center; color: #38bdf8; text-transform: uppercase; margin-bottom: 25px; }

.form-group {
    background: #2d3748;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #334155;
}

.form-group h2 { color: #38bdf8; font-size: 18px; margin-top: 0; margin-bottom: 15px; text-transform: uppercase; }

form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

textarea[name="descrizione"], 
textarea[name="alias_links"],
label { grid-column: span 2; }

input[type="text"], textarea, input[type="file"] {
    background: #1a222c;
    border: 1px solid #334155;
    color: #fff;
    padding: 12px;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

label { font-size: 12px; color: #94a3b8; margin-top: 5px; }

.btn-save {
    background: #10b981;
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    text-transform: uppercase;
    width: fit-content;
    margin-top: 10px;
}

table { width: 100%; border-collapse: collapse; background: #2d3748; margin-top: 20px; border-radius: 4px; overflow: hidden; }
thead tr { background-color: #38bdf8; }
th { color: #1a222c; padding: 12px; text-align: left; text-transform: uppercase; font-size: 13px; }
td { padding: 12px; border-bottom: 1px solid #334155; font-size: 14px; vertical-align: middle; }

table img { width: 45px !important; height: 45px !important; object-fit: cover; border-radius: 4px; }

.btn-edit { color: #38bdf8; text-decoration: none; font-weight: bold; margin-right: 15px; }
.btn-delete { color: #ef4444; text-decoration: none; font-weight: bold; }

/* ==========================================
   INDEX.PHP SISTEMATO
   ========================================== */

.index_main_title {
    text-align: center;
    color: #38bdf8;
    text-transform: uppercase;
    margin-bottom: 25px;
}

.site-card { 
    background: #2d3748; 
    margin-bottom: 25px; 
    padding: 20px; 
    display: flex; 
    gap: 25px; 
    border-left: 5px solid #38bdf8;
    align-items: flex-start;
    border-radius: 4px;
}

.left { 
    width: 280px; 
    flex-shrink: 0; 
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.logo-img { 
    width: 50px !important; 
    height: 50px !important; 
    border-radius: 50%; 
    border: 2px solid #38bdf8; 
    object-fit: cover; 
}

.index_site_name {
    margin: 0;
    color: #38bdf8;
    font-size: 20px;
    font-weight: bold;
}

.index_site_status_label {
    color: #FDFD96; 
    font-size: 11px;
    font-weight: bold;
}

.alias-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alias-item { display: flex; align-items: center; gap: 10px; }

.btn-alias { 
    background: #1a222c; 
    color: #38bdf8; 
    border: 1px solid #38bdf8; 
    padding: 6px 12px; 
    text-decoration: none; 
    font-size: 11px; 
    min-width: 110px; 
    text-align: center; 
    border-radius: 3px;
}

.status-on { color: #10b981; font-weight: bold; font-size: 11px; }
.status-off { color: #ef4444; font-weight: bold; font-size: 11px; }

.center { 
    flex-grow: 1; 
    white-space: pre-line; 
    font-size: 15px; 
    line-height: 1.3; 
    color: #cbd5e1;
    padding: 0 10px;
    margin: 0;
}

.right { 
    width: 300px; 
    height: 180px; 
    flex-shrink: 0; 
    background: #000; 
    border: 1px solid #4a5568; 
    border-radius: 4px;
    overflow: hidden;
}

.index_snapshot_img { 
    width: 100% !important; 
    height: 100% !important; 
    object-fit: cover; 
}

.index_debug_box {
    background: #000;
    color: #0f0;
    padding: 15px;
    border: 2px solid #38bdf8;
    font-size: 11px;
    margin-bottom: 20px;
}


/* ==========================================
    RESPONSIVE DESIGN (PER SMARTPHONE)
   ========================================== */

@media (max-width: 992px) {
    /* INDEX.PHP: Trasformiamo la card da orizzontale a verticale */
    .site-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 20px;
    }

    .left, .right {
        width: 100%; /* Occupano tutta la larghezza */
        max-width: 400px;
    }

    .right {
        height: auto;
        aspect-ratio: 16 / 9; /* Mantiene le proporzioni dello snapshot */
    }

    .center {
        padding: 10px 0;
        width: 100%;
    }

    .alias-item {
        justify-content: center; /* Centra i bottoni dei domini */
    }
}

@media (max-width: 600px) {
    /* BACKOFFICE: Il form passa a una sola colonna */
    form {
        grid-template-columns: 1fr;
    }

    /* Rendiamo la tabella del database scorrevole lateralmente per non rompere il layout */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    body {
        padding: 10px;
    }

    .index_main_title, h1 {
        font-size: 1.5rem;
    }
}

/* --- POSIZIONAMENTO LAST UPDATE --- */

.center {
    display: flex;
    flex-direction: column;
}

.index_last_update {
    order: 2; /* Sposta il div dopo la descrizione */
    color: #fef08a; /* Giallo pallido */
    font-size: 12px;
    font-style: italic;
    margin-top: 10px; /* Spazio tra descrizione e data */
}
