/* CSS Variables for Core Colors & Branding */
:root {
    --primary-color: #008996;
    --secondary-color: #b9ac94;
    --primary-black: #59595c;
    --secondary-black: #b0b0b0;
    --white: #ffffff;
    --black: #000000;
    --bg-page: #f4f6f8;
    --bg-card: #ffffff;

    /* Font definitions matching Flutter design */
    --font-primary: 'Outfit', sans-serif;
    --font-secondary: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

img {
    -webkit-user-drag: none;
    pointer-events: none;
}

.page-container {
    background: #ffffff;

    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);

    min-height: auto;
}

body {
    background-color: var(--primary-color);
    font-family: var(--font-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--primary-black);
}

/* Page container restricts maximum width and centers the view */
.page-container {
    width: 100%;
    max-width: 500px;
    /* Aligns with context.width < 500.w desktop constraint in Flutter */
    min-height: 100vh;
    background-color: var(--bg-card);
    position: relative;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

/* Status screens (Loading, Error) */
.status-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    display: flex;
    justify-content: center;
    align-items: center;

    background: #ffffff;

    z-index: 9999;
}

.spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 20px;
    border: 4px solid rgba(0, 137, 150, 0.12);
    border-top-color: #008996;
    border-radius: 50%;

    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.error-icon {
    width: 150px;
    margin-bottom: 25px;
}

.error-icon img {
    width: 100%;
    height: auto;
}

#error-screen h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

#error-screen p {
    font-size: 14px;
    color: var(--primary-black);
    margin-bottom: 30px;
    line-height: 1.5;
}

.error-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 80%;
}

/* Base button styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    width: 100%;
}

.btn-primary,
.btn-secondary,
.btn-save-contact,
.icon-item {
    transition:
        transform 0.15s ease-out,
        filter 0.15s ease-out;
}

.btn-primary:active,
.btn-secondary:active,
.btn-save-contact:active,
.icon-item:active {
    transform: scale(0.60);
    filter: brightness(0.92);
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(0, 137, 150, 0.25);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(185, 172, 148, 0.25);
}


/* Profile Card Styling */
.profile-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Intro Section (Cover + Logo + Avatar) */
.intro-section {
    position: relative;
    height: 250px;
    width: 100%;
    margin-bottom: 15px;
}

.cover-image-container {
    width: 100%;
    height: 190px;
    border-radius: 0px 0px 25px 25px;
    overflow: hidden;
}

.cover-image {
    width: 100%;
    height: 100%;
    object-fit: fill;
    /* Matches BoxFit.fill in Flutter code */
}

.brand-logo-container {
    position: absolute;
    top: 30px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.brand-logo {
    width: 130px;
    height: auto;
    /* Flutter uses `color: AppColors.whiteColor` to paint the asset white */
    filter: brightness(0) invert(1);
}

.avatar-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
}

.avatar-border {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 6px solid var(--white);
    background-color: var(--white);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Profile Headers */
.profile-header {
    text-align: center;
    padding: 0 20px;
    margin-bottom: 15px;
}

.employee-name {
    font-family: var(--font-primary);
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.employee-title {
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 300;
    color: var(--primary-black);
    margin-bottom: 4px;
}

.employee-second-title {
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 300;
    color: var(--primary-black);
}

/* Save Contact Button Section */
.primary-action-section {
    display: flex;
    justify-content: center;
    padding: 0 20px;
    margin-bottom: 15px;
    height: 45px;
}

.btn-save-contact {
    background-color: var(--primary-color);
    color: var(--white);
    width: 50%;
    /* context.width / 2 */
    box-shadow: 0 4px 10px rgba(0, 137, 150, 0.2);
}

/* Info Section Containers */
.info-section-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 16px;
    margin-bottom: 15px;
}

.section-title {
    font-family: var(--font-primary);
    font-size: 15px;
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 8px;
    text-align: center;
}

/* Information Grids */
.grid-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 35px;
    /* mainAxisSpacing: 35.h, crossAxisSpacing: 35.w */
    padding: 0 20px 20px 20px;
    /* Left, right, bottom 20px padding */
    width: 100%;
}

.grid-4col {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    /* mainAxisSpacing: 20.h, crossAxisSpacing: 20.w */
    padding: 0 20px 20px 20px;
    width: 100%;
}

/* Grid Icon Item styling */
.icon-item {
    position: relative;
    border-radius: 11px;
    background-color: var(--primary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
    aspect-ratio: 1/1;
    box-shadow: 0 3px 8px rgba(0, 137, 150, 0.15);
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    justify-self: stretch;
    -webkit-user-drag: none;

}

.icon-item i {
    font-size: 26px;
    /* iconSize: 35.w but standard FA icons look best around 26-28px */
    -webkit-user-drag: none;

}

/* Second Phone Badge overlay */
.badge-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--secondary-color);
    color: var(--white);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Address List */
.address-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* separatorBuilder: => 10.height */
    width: 100%;
}

.address-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.address-title {
    font-family: var(--font-primary);
    font-size: 10px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.address-detail {
    font-family: var(--font-primary);
    font-size: 8px;
    font-weight: 500;
    color: var(--primary-black);
    max-width: 90%;
    line-height: 1.4;
}

/* =========================================
   Companies Logos Footer
========================================= */

.companies-logos-footer {
    display: grid;

    /* Row 1: Headers
       Row 2: Logos + Separators */
    grid-template-columns: 1fr 1px 1fr 1px 1fr;

    grid-template-rows: auto auto;

    width: 100%;
    padding: 20px 20px;

    column-gap: 12px;
    row-gap: 15px;

    align-items: center;
}

/* =========================================
   Headers Placement
========================================= */

.header-hurghada {
    grid-column: 1;
    grid-row: 1;
}

.header-cairo {
    grid-column: 3;
    grid-row: 1;
}

.header-london {
    grid-column: 5;
    grid-row: 1;
}

.destination-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* =========================================
   Logos Placement
========================================= */

.logos-hurghada {
    grid-column: 1;
    grid-row: 2;
}

.logos-cairo {
    grid-column: 3;
    grid-row: 2;
}

.logos-london {
    grid-column: 5;
    grid-row: 2;
}

.destination-logos {
    min-width: 0;

    display: flex;
    justify-content: center;
    align-items: center;
}

/* =========================================
   Separators
========================================= */

.sep-1 {
    grid-column: 2;
    grid-row: 2;
}

.sep-2 {
    grid-column: 4;
    grid-row: 2;
}

.logos-separator {
    width: 1px;
    background: rgba(0, 0, 0, 0.15);

    justify-self: center;
    align-self: stretch;
}

/* =========================================
   Titles
========================================= */

.dest-title {
    margin: 0;

    font-family: var(--font-primary);
    font-size: 12px;
    font-weight: 700;

    color: var(--primary-black);
}

.dest-subtitle {
    font-family: var(--font-primary);
    font-size: 8px;
    font-weight: 600;

    color: var(--primary-black);

    opacity: .7;
    letter-spacing: 1px;
}

.dest-logo-title {
    width: 90px;
    height: auto;

    filter: brightness(0) saturate(100%) invert(34%) sepia(5%) saturate(225%) hue-rotate(201deg) brightness(96%) contrast(83%);
}

/* =========================================
   Partner Logos
========================================= */

.partner-logo {
    width: auto;
    height: 28px;
    max-width: 100%;

    object-fit: contain;

    filter: brightness(0) saturate(100%) invert(34%) sepia(5%) saturate(225%) hue-rotate(201deg) brightness(96%) contrast(83%);
}

/* =========================================
   Hurghada
========================================= */

.logos-grid-2x2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);

    gap: 8px;
    width: 90%;
}

/* =========================================
   Cairo
========================================= */

.logos-cairo-grid {
    display: flex;
    flex-direction: column;

    gap: 8px;
    width: 100%;
}

.logo-row {
    display: grid;
    gap: 8px;

    align-items: center;
}

.logo-row:not(.three-logos) {
    grid-template-columns: repeat(2, 1fr);
}

.logo-row.three-logos {
    grid-template-columns: repeat(3, 1fr);
}

/* =========================================
   London
========================================= */

.logos-row-london {
    display: flex;

    justify-content: center;
    align-items: center;

    gap: 15px;
}

.logos-row-london .partner-logo {
    height: auto;
    width: 40%;
}

/*==============================*/