/* ============================================ */
/* COMPLETE HEADER STYLES - REVISED */
/* ============================================ */

/* Header Container */
.vcard-header {
    position: relative;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 2rem 1rem 1.5rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    overflow: hidden;
}

/* Background Image */
.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* Gradient Background (when no image) */
.gradient-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    z-index: 1;
}

/* Overlay - ONLY on background image */
.background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 2;
}

/* Content Container - everything above overlay */
.header-content {
    position: relative;
    z-index: 10;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* ============================================ */
/* ACTIONS ROW - PERFECT ALIGNMENT WITH GRID */
/* ============================================ */
.header-actions-row {
    position: absolute;
    top: 1rem;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;  /* Three columns: left auto, center auto, right auto */
    align-items: center;
    gap: 0;  /* No gap - spacing controlled by grid columns */
    padding: 0 1rem;
    z-index: 20;
}

/* Left Actions Container */
.header-action-left {
    justify-self: start;  /* Align to left within its column */
}

/* Right Actions Container */
.header-action-right {
    justify-self: end;  /* Align to right within its column */
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ============================================ */
/* STATS BADGE - PERFECTLY CENTERED */
/* ============================================ */
.stats-badge {
    justify-self: center;  /* Center within its column */
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.5rem 1.2rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    color: white;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 1.2rem;  /* Gap between eye and qr sections */
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: fit-content;  /* Shrink to fit content */
    max-width: 90%;  /* Prevent overflow on small screens */
    white-space: nowrap;  /* Keep on one line */
}

/* themes/base.css and header_bookmark.css position these absolutely; in the actions row they are grid cells
   (share | stats | bookmark, mirrored in RTL) */
.header-actions-row > .header-action-left,
.header-actions-row > .stats-badge,
.header-actions-row > .header-action-right {
    position: static;
    grid-row: 1;
}
.header-actions-row > .header-action-left { grid-column: 1; }
.header-actions-row > .stats-badge { grid-column: 2; max-width: none; }
.header-actions-row > .header-action-right { grid-column: 3; }

/* Stats Items */
.stats-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.stats-item i {
    font-size: 1rem;
    line-height: 1;
}

/* Add separator between the two stats */
.stats-item:first-child {
    position: relative;
    padding-right: 0;
}

.stats-item:first-child::after {
    content: '';
    position: absolute;
    inset-inline-end: -0.6rem;  /* Half of the gap */
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, 0.3);
}

/* Stats numbers */
.stats-number {
    font-weight: 600;
    line-height: 1;
    min-width: 2em;  /* Minimum width for numbers to prevent shifting */
    text-align: right;
}

/* ============================================ */
/* MAIN ACTIONS BUTTON */
/* ============================================ */
.btn-main-actions {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    color: var(--primary-color, '#0d6efd');
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-main-actions:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* ============================================ */
/* BOOKMARK BUTTON */
/* ============================================ */
.btn-bookmark-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #dc3545;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-bookmark-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.btn-bookmark-toggle.bookmarked {
    color: #dc3545;
}

/* css/bookmark.css loads after this file; keep the header bookmark the same size as the share button */
.header-action-right .btn-bookmark-toggle,
.header-action-right .btn-bookmark-toggle.bookmarked {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    background: white;
    color: #dc3545;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-action-right .btn-bookmark-toggle.loading {
    opacity: 0.7;
    cursor: wait;
}

.header-action-right .btn-bookmark-toggle .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}

/* ============================================ */
/* CIRCULAR BUTTONS STACK (SHARE MENU) */
/* ============================================ */
#actions-container {
    position: relative;
}

.circular-buttons-stack {
    display: none;
    position: absolute;
    top: 50px;
    inset-inline-start: 0;  /* under the share button in LTR and RTL */
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}

.circular-buttons-stack.show {
    display: flex;
}

.circular-action-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.circular-action-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

/* Button colors */
.circular-action-btn.share {
    color: #25D366;
}
.circular-action-btn.whatsapp {
    color: #25D366;
}
.circular-action-btn.email {
    color: #ea4335;
}
.circular-action-btn.telegram {
    color: #229ED9;
}
.circular-action-btn.copy {
    color: #0d6efd;
}
.circular-action-btn.native-share {
    color: #6c757d;
}
.circular-action-btn[hidden] {
    display: none;
}

/* ============================================ */
/* PROFILE IMAGE */
/* ============================================ */
.profile-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    margin-bottom: 1rem;
}

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

/* Company Name and Tagline */
.vcard-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.vcard-header p {
    font-size: 1rem;
    opacity: 0.95;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ============================================ */
/* MOBILE ADJUSTMENTS */
/* ============================================ */
@media (max-width: 480px) {
    .vcard-header {
        min-height: 240px;
        padding: 1.5rem 1rem 1rem;
    }

    .header-actions-row {
        padding: 0 0.75rem;
    }

    .stats-badge {
        padding: 0.4rem 1rem;
        font-size: 0.75rem;
        gap: 1rem;
    }

    .stats-item i {
        font-size: 0.85rem;
    }

    .stats-item:first-child::after {
        height: 14px;
        inset-inline-end: -0.5rem;
    }

    .profile-image {
        width: 80px;
        height: 80px;
    }

    .vcard-header h2 {
        font-size: 1.5rem;
    }

    .vcard-header p {
        font-size: 0.9rem;
    }

    .btn-main-actions,
    .btn-bookmark-toggle {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .circular-action-btn {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
}

/* Small mobile adjustments */
@media (max-width: 360px) {
    .stats-badge {
        padding: 0.35rem 0.85rem;
        font-size: 0.7rem;
        gap: 0.85rem;
    }

    .stats-item:first-child::after {
        inset-inline-end: -0.4rem;
    }
}
