/* ============================================================
   Digital Business Card — Pierluca Poscolere | Omnia Service
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:           #dde3ec;
    --card:         #f4f7fb;
    --btn:          #e8edf5;
    --btn-hover:    #dce3ef;
    --accent:       #e31e24;
    --accent-hover: #c01820;
    --text:         #1a202c;
    --text-sub:     #64748b;
    --border:       rgba(0,0,0,0.09);
    --shadow:       0 24px 64px rgba(0,0,0,0.12);
    --r:            16px;
    --r-btn:        12px;
}

html { height: 100%; }

body {
    min-height: 100%;
    background: var(--bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* ── Card container ── */
.card {
    width: 100%;
    max-width: 460px;
    background: var(--card);
    min-height: 100svh;
}

@media (min-width: 520px) {
    body { padding: 32px 16px 48px; align-items: flex-start; }
    .card {
        min-height: auto;
        border-radius: var(--r);
        box-shadow: var(--shadow);
        overflow: hidden;
    }
}

/* ── Header / Logo ── */
.card-header {
    background: linear-gradient(160deg, #ffffff 0%, #eef2f9 100%);
    padding: 28px 32px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border);
    min-height: 100px;
}

.card-header img {
    max-width: 220px;
    max-height: 72px;
    object-fit: contain;
}

.logo-fallback {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
}
.logo-fallback span { color: var(--accent); }

/* ── Profile ── */
.profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 24px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.avatar {
    width: 138px;
    height: 138px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    margin-bottom: 14px;
    background: var(--btn);
    /* fallback when image missing */
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-fallback {
    width: 138px;
    height: 138px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    background: var(--btn);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 14px;
    flex-shrink: 0;
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.profile-role {
    font-size: 0.875rem;
    color: var(--text-sub);
    line-height: 1.5;
    margin-bottom: 8px;
    max-width: 280px;
}

.profile-company {
    font-size: 0.8125rem;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ── Save Contact button ── */
.btn-save {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin: 20px 20px 16px;
    padding: 15px 20px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: var(--r-btn);
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.btn-save:active { transform: scale(0.98); background: var(--accent-hover); }

@media (hover: hover) {
    .btn-save:hover { background: var(--accent-hover); }
}

/* ── QR button ── */
.btn-qr {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: -4px 20px 16px;
    padding: 7px 20px;
    background: transparent;
    color: var(--text-sub);
    text-decoration: none;
    border-radius: var(--r-btn);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border);
    transition: background 0.18s, color 0.18s;
    -webkit-tap-highlight-color: transparent;
}
.btn-qr:active { background: var(--btn-hover); }
@media (hover: hover) {
    .btn-qr:hover { background: var(--btn); color: var(--text); }
}

/* ── Contact buttons ── */
.contacts {
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.contact-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 15px;
    background: var(--btn);
    border-radius: var(--r-btn);
    text-decoration: none;
    color: var(--text);
    transition: background 0.18s, transform 0.1s;
    border: 1px solid var(--border);
    -webkit-tap-highlight-color: transparent;
}

.contact-btn:active { transform: scale(0.985); background: var(--btn-hover); }

@media (hover: hover) {
    .contact-btn:hover { background: var(--btn-hover); }
}

.contact-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.contact-info { flex: 1; min-width: 0; }

.contact-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-sub);
    margin-bottom: 2px;
    display: block;
}

.contact-value {
    font-size: 0.9375rem;
    font-weight: 500;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-arrow {
    color: var(--text-sub);
    font-size: 0.8rem;
    flex-shrink: 0;
    opacity: 0.6;
}

/* Icon accent colors */
.icon-email    { background: rgba(59,130,246,0.15);  color: #3b82f6; }
.icon-phone    { background: rgba(34,197,94,0.15);   color: #22c55e; }
.icon-whatsapp { background: rgba(37,211,102,0.15);  color: #25d366; }
.icon-telegram { background: rgba(44,165,224,0.15);  color: #2ca5e0; }
.icon-website  { background: rgba(227,30,36,0.15);   color: #e31e24; }
.icon-linkedin { background: rgba(10,102,194,0.15);  color: #0a66c2; }

.contact-separator { height: 3px; background: linear-gradient(90deg, transparent, rgba(0,0,0,0.25) 10%, rgba(0,0,0,0.25) 90%, transparent); margin: 6px 4px; border-radius: 2px; }

/* ── Company info (collapsible) ── */
.info-section {
    margin: 4px 20px 20px;
    border: 1px solid var(--border);
    border-radius: var(--r-btn);
    overflow: hidden;
}

.info-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--btn);
    cursor: pointer;
    user-select: none;
    border: none;
    width: 100%;
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.18s;
    -webkit-tap-highlight-color: transparent;
}

.info-toggle:active { background: var(--btn-hover); }
@media (hover: hover) { .info-toggle:hover { background: var(--btn-hover); } }

.info-toggle .chevron {
    transition: transform 0.28s ease;
    color: var(--text-sub);
    font-size: 0.875rem;
}

.info-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.info-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.info-body.open { max-height: 900px; }

.info-content {
    padding: 18px 16px;
    background: rgba(0,0,0,0.03);
    border-top: 1px solid var(--border);
}

.info-content p {
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--text-sub);
    margin-bottom: 10px;
}

.info-content p:last-child { margin-bottom: 0; }

.info-content a {
    color: var(--accent);
    text-decoration: none;
}

.info-content a:hover { text-decoration: underline; }

.info-divider {
    height: 1px;
    background: var(--border);
    margin: 14px 0;
}

.info-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-sub);
    margin-bottom: 6px;
}

.info-content strong { color: var(--text); font-weight: 600; }

/* ── Rich text (output Quill) ── */
.rich-text p          { font-size: 0.875rem; line-height: 1.65; color: var(--text-sub); margin-bottom: 0; }
.rich-text strong     { color: var(--text); font-weight: 600; }
.rich-text em         { font-style: italic; }
.rich-text u          { text-decoration: underline; }
.rich-text s          { text-decoration: line-through; }
.rich-text h2         { font-size: 0.9375rem; font-weight: 700; color: var(--text); margin-bottom: 6px; margin-top: 10px; }
.rich-text h3         { font-size: 0.875rem;  font-weight: 600; color: var(--text); margin-bottom: 4px; margin-top: 8px; }
.rich-text ul,
.rich-text ol         { padding-left: 1.4em; margin-bottom: 8px; }
.rich-text li         { font-size: 0.875rem; line-height: 1.65; color: var(--text-sub); margin-bottom: 2px; }
.rich-text br         { display: block; content: ''; }

/* Allineamento testo da Quill */
.rich-text .ql-align-center  { text-align: center; }
.rich-text .ql-align-right   { text-align: right; }
.rich-text .ql-align-justify { text-align: justify; }


.info-slogan {
    text-align: center;
    font-style: italic;
    padding: 4px 0;
}

/* ── Legal block ── */
.legal-block {
    margin: 0 20px 20px;
    padding: 12px 16px;
    background: rgba(0,0,0,0.03);
    border: 1px solid var(--border);
    border-radius: var(--r-btn);
    font-size: 0.75rem;
    line-height: 1.75;
    color: var(--text-sub);
    text-align: center;
}

.legal-block-label {
    display: block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-sub);
    opacity: 0.65;
    margin-bottom: 5px;
}

/* ── Footer ── */
.card-footer {
    text-align: center;
    padding: 14px 20px 28px;
    font-size: 0.75rem;
    color: var(--text-sub);
    border-top: 1px solid var(--border);
    opacity: 0.7;
}

.admin-link {
    display: inline-block;
    margin-left: 10px;
    font-size: 0.6rem;
    color: rgba(0,0,0,0.08);
    text-decoration: none;
    vertical-align: middle;
    transition: color 0.3s;
    user-select: none;
}
.admin-link:hover { color: rgba(0,0,0,0.25); }
