/* ==========================================================================
   GESTIONALE V3 - CSS ADMIN DEFINITIVO
   ========================================================================== */

:root {
    --primary: #ec8300;
    /* Arancio Balistra */
    --attivita: #e85855;
    --immobili: #247ba0;
    --richieste: #4cbaa7;
    --notizie: #edc844;
    --dark: #333;
    --border: #dee2e6;
    --bg: #f4f7f9;
}

body {
    background-color: var(--bg);
    margin: 0;
    font-family: 'Inter', sans-serif;
}

/* --- HEADER (Esattamente come in foto) --- */
.admin-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    width: 100%;
    height: 70px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    width: 100%;
    max-width: 1400px;
    /* Largo su PC */
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Brand Sinistra */
.brand-name {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--dark);
}

.brand-name .v3 {
    color: var(--primary);
    font-size: 0.9rem;
}

/* Menu Destra */
.header-right {
    display: flex;
    align-items: center;
    height: 70px;
}

.header-block {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #555;
    padding: 0 25px;
    height: 100%;
    transition: background 0.2s;
}

.header-block:hover {
    background: #f8f9fa;
}

/* Il divisore tra Profilo e Logout */
.header-block.border-right {
    border-right: 1px solid #eee;
}

.header-icon {
    font-size: 22px;
    margin-right: 12px;
    color: #777;
}

.header-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.main-label {
    font-size: 16px;
    font-weight: 600;
    color: #444;
    line-height: 1.2;
}

.sub-label {
    font-size: 12px;
    color: #888;
}

/* Nascondi burger menu su PC */
.menu-toggle {
    display: none;
}

/* --- DASHBOARD (Griglia 2x2 Mobile / 4x1 PC) --- */
.main-content {
    max-width: 1300px;
    margin: 30px auto;
    padding: 0 20px 100px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.dash-item {
    padding: 50px 20px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.dash-item:nth-child(2n) {
    border-right: none;
}

.dash-item i {
    font-size: 45px;
    margin-bottom: 15px;
    display: block;
}

.dash-item h6 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.color-notizie {
    color: var(--notizie);
}

.color-attivita {
    color: var(--attivita);
}

.color-richieste {
    color: var(--richieste);
}

.color-immobili {
    color: var(--immobili);
}

/* --- FORM CARDS --- */
.form-card {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 25px;
}

.form-card h3 {
    margin: 0 0 20px;
    font-size: 15px;
    color: var(--immobili);
    text-transform: uppercase;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}

.grid-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* --- RESPONSIVE --- */
@media (min-width: 992px) {
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .dash-item {
        border-bottom: none;
    }

    .dash-item:nth-child(n) {
        border-right: 1px solid var(--border);
    }

    .dash-item:last-child {
        border-right: none;
    }

    .grid-fields {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .sub-label {
        display: none;
    }

    .header-block {
        padding: 0 10px;
    }
}

.admin-header {
    position: sticky;
    top: 0;
    z-index: 9999;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.header-container {
    min-height: 64px;
}

.agency-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.agency-logo {
    max-height: 42px;
    max-width: 160px;
    object-fit: contain;
    display: block;
}

.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    overflow: hidden;
    background: #e5e7eb;
    flex: 0 0 36px;
}

.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Mobile */
@media (max-width: 600px) {
    .header-container {
        min-height: 58px;
        padding: 0 10px;
    }

    .agency-logo {
        max-height: 36px;
        max-width: 115px;
    }

    .header-right {
        gap: 4px;
    }

    .header-block {
        padding: 6px 8px;
    }

    .header-avatar {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }

    .header-block .sub-label {
        display: none;
    }

    .header-block .main-label {
        font-size: 12px;
    }

    .header-icon {
        width: 28px;
        height: 28px;
    }
}

/*
|--------------------------------------------------------------------------
| BOTTOM MOBILE NAV
|--------------------------------------------------------------------------
*/

body:not(.login-page-body) {
    padding-bottom: 78px;
}

.bottom-mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 72px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    z-index: 9999;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: #374151;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.2s ease;
}

.bottom-nav-item i {
    font-size: 20px;
}

.bottom-nav-item:hover {
    color: #2563eb;
}

.bottom-nav-item.active {
    color: #2563eb;
}

/*
|--------------------------------------------------------------------------
| DESKTOP
|--------------------------------------------------------------------------
*/

@media (min-width: 1024px) {

    .bottom-mobile-nav {
        max-width: 520px;
        left: 50%;
        transform: translateX(-50%);
        bottom: 14px;
        border-radius: 24px;
        height: 74px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    }
}

/* DASHBOARD STILE IMMOBILIARE01 */

.generic_container {
    max-width: 760px;
    margin: 0 auto;
}

.dashboard {
    padding-left: 0;
    padding-right: 0;
}

.dashboard-row {
    background: #fff;
}

.dashboard-cell {
    color: #212529;
    text-decoration: none;
    min-height: 155px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.dashboard-cell:hover {
    text-decoration: none;
    background: #f8f9fa;
}

.dashboard-cell h6 {
    margin-top: 12px;
    font-size: 16px;
    font-weight: 700;
    color: #222;
}

.color_notizie {
    color: #edc844;
}

.color_attivita {
    color: #e85855;
}

.color_acquirenti {
    color: #4cbaa7;
}

.color_immobili {
    color: #247ba0;
}

.my_list_group .list-group-item {
    min-height: 78px;
    border: 1px solid #e2e8f0;
    padding: 16px;
    color: #212529;
    text-decoration: none;
}

.my_list_group .list-group-item:hover {
    background: #f8f9fa;
    text-decoration: none;
}

.my_list_group .list_text {
    margin-left: 58px;
}

.my_list_group h6 {
    margin: 0 0 4px;
    font-weight: 700;
}

.my_list_group p {
    margin: 0;
    font-size: 13px;
    color: #6c757d;
}

.no_underline {
    text-decoration: none !important;
}

@media (max-width: 480px) {
    .main-content {
        margin-top: 14px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .dashboard-cell {
        min-height: 135px;
        padding: 28px 10px !important;
    }

    .dashboard-cell .fa-4x {
        font-size: 3em;
    }
}

.form-card input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    background: #fff;
}

.form-card label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #475569;
}

.btn-save-profile {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
}

.btn-save-profile:hover {
    opacity: 0.9;
}

.alert-success-profile {
    background: #dcfce7;
    color: #166534;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 700;
}

.alert-error-profile {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 700;
}

.form-card input[readonly] {
    background: #f1f5f9;
    color: #64748b;
}

.profile-image-preview {
    width: 110px;
    height: 110px;
    border-radius: 18px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 10px;
}

.profile-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-image-preview.logo-preview {
    width: 180px;
    height: 90px;
    border-radius: 14px;
}

.profile-image-preview.logo-preview img {
    object-fit: contain;
    padding: 8px;
}

/* HEADER MOBILE PROFILE FIX */

.large-avatar {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
}

.large-avatar img {
    width: 56px;
    height: 56px;
    object-fit: cover;
}

.profile-mobile-block {
    gap: 10px;
}

.header-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.profile-mobile-block .main-label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.sub-label {
    display: none !important;
}

.logout-mobile-block .main-label {
    font-size: 16px;
    font-weight: 800;
}

@media (max-width: 600px) {
    .header-container {
        padding: 0 8px;
    }

    .agency-logo {
        max-height: 38px;
        max-width: 100px;
    }

    .header-block {
        padding: 6px 8px;
    }

    .large-avatar {
        width: 58px;
        height: 58px;
        flex: 0 0 58px;
    }

    .large-avatar img {
        width: 58px;
        height: 58px;
    }

    .profile-mobile-block .main-label {
        font-size: 12px;
        font-weight: 500;
        line-height: 1.2;
        color: #666;
    }

    .logout-mobile-block .main-label {
        font-size: 13px;
    }

    .header-icon {
        margin-right: 6px;
    }
}

.admin-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.admin-page-header h1 {
    margin: 0;
    font-size: 28px;
}

.admin-page-header p {
    margin: 4px 0 0;
    color: #64748b;
}

.admin-btn-primary {
    background: #ec8300;
    color: #fff;
    padding: 12px 16px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 800;
}

.admin-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 18px;
}

.admin-filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.admin-filters input {
    width: 100%;
    padding: 13px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.property-add-row,
.property-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 16px;
    text-decoration: none;
    color: #111827;
}

.property-add-icon,
.property-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: #fff7ed;
    color: #ec8300;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.property-add-row h3,
.property-row h3 {
    margin: 0;
    font-size: 18px;
}

.property-add-row p,
.property-row p {
    margin: 3px 0 0;
    color: #64748b;
}

.property-add-plus {
    margin-left: auto;
    color: #ec8300;
    font-size: 22px;
}

.property-status {
    margin-left: auto;
    background: #f1f5f9;
    color: #334155;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.empty-state {
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
    padding: 24px;
    text-align: center;
    color: #64748b;
}

@media (max-width: 700px) {
    .admin-page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-btn-primary {
        width: 100%;
        text-align: center;
    }

    .admin-filters {
        grid-template-columns: 1fr;
    }

    .property-row,
    .property-add-row {
        align-items: flex-start;
    }

    .property-status {
        display: none;
    }
}

/* ==========================================================
   PAGINA IMMOBILI
   ========================================================== */

.admin-main {
    padding: 24px;
}

@media (max-width: 768px) {

    .admin-main {
        padding:
            16px 16px 90px;
    }

}

/* ==========================================================
   FORM NUOVO IMMOBILE
   ========================================================== */

.property-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-section {
    padding: 20px;
}

.form-section-title {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

.form-section-title i {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #fff7ed;
    color: #ec8300;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.form-section-title h2 {
    margin: 0;
    font-size: 20px;
    color: #111827;
}

.form-section-title p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-field-full {
    grid-column: 1 / -1;
}

.form-field-large {
    grid-column: span 1;
}

.form-field label {
    font-weight: 800;
    font-size: 13px;
    color: #334155;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 14px;
    padding: 13px 14px;
    font-size: 15px;
    color: #111827;
    outline: none;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: #ec8300;
    box-shadow: 0 0 0 3px rgba(236, 131, 0, .15);
}

.form-field textarea {
    resize: vertical;
}

.form-check-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.form-check-grid label {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 12px;
    font-weight: 700;
    color: #334155;
    display: flex;
    gap: 8px;
    align-items: center;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-bottom: 100px;
}

.admin-btn-secondary {
    background: #f1f5f9;
    color: #334155;
    padding: 12px 16px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 800;
    border: 1px solid #e5e7eb;
}

.admin-btn-secondary:hover,
.admin-btn-primary:hover {
    text-decoration: none;
    opacity: .9;
}

@media (max-width: 800px) {

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-field-full,
    .form-field-large {
        grid-column: auto;
    }

    .form-check-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions a,
    .form-actions button {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

}

.media-grid-admin {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.media-admin-card {
    position: relative;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    overflow: hidden;
}

.media-admin-card img {
    width: 100%;
    height: 230px;
    object-fit: cover;
    display: block;
    background: #f1f5f9;
}

.media-doc-icon {
    height: 230px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    color: #64748b;
    font-size: 60px;
}

.media-cover-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #ec8300;
    color: #fff;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.media-admin-body {
    padding: 16px;
    display: grid;
    gap: 12px;
}

.media-delete-check {
    margin-top: 4px;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 10px;
    font-weight: 800;
}

@media (max-width: 800px) {
    .media-grid-admin {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================
   MEDIA AI SEO
   ========================================================== */

.media-ai-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 12px;
}

.media-ai-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #111827;
    color: #fff;
    border-radius: 12px;
    padding: 11px 14px;
    font-weight: 900;
    text-decoration: none;
}

.media-ai-btn:hover {
    opacity: .9;
    text-decoration: none;
}

.media-ai-status {
    font-size: 12px;
    font-weight: 800;
    color: #64748b;
}

.media-ai-status.success {
    color: #166534;
}

.admin-dashboard {
    padding: 28px;
}

.dashboard-hero {
    background: linear-gradient(135deg, #10243a, #1d5f8f);
    color: #fff;
    border-radius: 28px;
    padding: 34px;
    margin-bottom: 28px;
    box-shadow: 0 20px 60px rgba(15, 35, 55, .18);
}

.dashboard-kicker {
    display: inline-block;
    color: #f7b733;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
}

.dashboard-hero h1 {
    margin: 0 0 8px;
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1;
}

.dashboard-hero p {
    margin: 0;
    max-width: 720px;
    color: rgba(255, 255, 255, .85);
    font-size: 18px;
}

.dashboard-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-action-card {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 132px;
    padding: 22px;
    background: #fff;
    border-radius: 24px;
    text-decoration: none;
    color: #132033;
    box-shadow: 0 16px 45px rgba(15, 35, 55, .08);
    border: 1px solid rgba(15, 35, 55, .08);
    transition: transform .18s ease, box-shadow .18s ease;
}

.dashboard-action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 70px rgba(15, 35, 55, .14);
}

.dashboard-action-icon {
    width: 58px;
    height: 58px;
    min-width: 58px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    background: #f1f5f9;
}

.dashboard-action-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dashboard-action-content strong {
    font-size: 21px;
    line-height: 1.1;
}

.dashboard-action-content small {
    font-size: 14px;
    line-height: 1.35;
    color: #64748b;
}

.dashboard-action-arrow {
    margin-left: auto;
    font-size: 24px;
    font-weight: 900;
    color: #94a3b8;
}

.dashboard-action-blue .dashboard-action-icon {
    background: #e0f2fe;
}

.dashboard-action-cyan .dashboard-action-icon {
    background: #cffafe;
}

.dashboard-action-orange .dashboard-action-icon {
    background: #ffedd5;
}

.dashboard-action-purple .dashboard-action-icon {
    background: #f3e8ff;
}

.dashboard-action-green .dashboard-action-icon {
    background: #dcfce7;
}

.dashboard-action-red .dashboard-action-icon {
    background: #fee2e2;
}

.dashboard-action-dark .dashboard-action-icon {
    background: #e2e8f0;
}

.dashboard-action-gray .dashboard-action-icon {
    background: #f1f5f9;
}

@media (max-width: 1100px) {
    .dashboard-actions-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .admin-dashboard {
        padding: 16px;
    }

    .dashboard-hero {
        padding: 24px;
        border-radius: 22px;
    }

    .dashboard-actions-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .dashboard-action-card {
        min-height: 106px;
        border-radius: 20px;
        padding: 18px;
    }
}

/* Dashboard mobile/tablet */
.dashboard-actions-grid {
    display: grid;
    gap: 16px;
}

/* smartphone normale: 2 colonne */
@media (max-width: 768px) {
    .dashboard-actions-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-action-card {
        min-height: 120px;
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        justify-content: space-between;
    }

    .dashboard-action-icon {
        font-size: 28px;
    }

    .dashboard-action-content strong {
        font-size: 15px;
    }

    .dashboard-action-content small {
        font-size: 12px;
        line-height: 1.3;
    }

    .dashboard-action-arrow {
        align-self: flex-end;
    }
}

/* schermi piccolissimi: 1 colonna */
@media (min-width: 769px) and (max-width: 1100px) {
    .dashboard-actions-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1101px) {
    .dashboard-actions-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}