@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@300;400;600;700&display=swap');

:root {
    --bg-color: #051024;
    --text-color-primary: #333333;
    --text-color-secondary: #666666;
    --card-bg: #ffffff;
    --accent-color: #00a8e8;
    --bloom-color-1: rgba(0, 168, 232, 0.4);
    --bloom-color-2: rgba(100, 255, 218, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito Sans', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Background Bloom Effects */
.bloom-effect {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: float 10s infinite ease-in-out alternate;
}

.bloom-1 {
    width: 400px;
    height: 400px;
    background: var(--bloom-color-1);
    top: -50px;
    left: -50px;
}

.bloom-2 {
    width: 500px;
    height: 500px;
    background: var(--bloom-color-2);
    bottom: 0px;
    right: -100px;
    animation-delay: -5s;
}

.bloom-3 {
    width: 300px;
    height: 300px;
    background: rgba(120, 80, 255, 0.25);
    top: 40%;
    left: 20%;
    animation-duration: 15s;
    filter: blur(100px);
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(20px, 40px) scale(1.1);
    }
}

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
    width: 100%;
    background: rgba(5, 16, 36, 0.5);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    height: 50px;
    margin-right: 20px;
}

header h1 {
    color: #ffffff;
    font-weight: 700;
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.contact-list-link {
    text-decoration: none;
}

.contact-list-container {
    position: relative;
    padding: 3px;
    background: linear-gradient(90deg, #03a9f4, #f441a5);
    border-radius: 0.9em;
    transition: all 0.4s ease;
}

.contact-list-container::before {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    border-radius: 0.9em;
    z-index: -10;
    filter: blur(0);
    transition: filter 0.4s ease;
}

.contact-list-container:hover::before {
    background: linear-gradient(90deg, #03a9f4, #f441a5);
    filter: blur(1.2em);
}

.contact-list-container:active::before {
    filter: blur(0.2em);
}

.contact-list-button {
    font-size: 1.4em;
    padding: 0.6em 0.8em;
    border-radius: 0.5em;
    border: none;
    background-color: #000;
    color: #fff;
    cursor: pointer;
    box-shadow: 2px 2px 3px #000000b4;
    font-family: inherit;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
}

.client-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 1000px;
    /* Increased width for side-by-side */
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.8s ease-out forwards;
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header {
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 5px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.name-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.client-name {
    font-size: 2rem;
    color: #1a1a1a;
    font-weight: 800;
}

.client-status {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
}

.boat-name {
    font-size: 1.25rem;
    color: #555;
    background: #f0f4f8;
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 600;
}

/* Layout for content */
.card-body {
    display: flex;
    gap: 25px;
    justify-content: space-between;
    align-items: flex-start;
}

.data-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.image-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    /* Changed to column to stack image and map */
    justify-content: flex-start;
    /* Changed to start */
    align-items: flex-end;
    /* Keep aligned to right */
    min-width: 300px;
    gap: 20px;
    /* Gap between image and map */
}

.boat-photo {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: none;
    /* Hidden by default if empty */
}

.map-container {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    background: #f0f0f0;
    /* placeholder color */
}

.appsheet-launcher {
    width: auto;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    align-self: center;
}

.appsheet-launcher-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.appsheet-launch-button {
    outline: 0;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-width: 200px;
    border: 0;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
    padding: 16px 20px;
    background: #192972;
    color: #fff;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.appsheet-launch-button:hover {
    opacity: 1;
    background: #5c75e4;
    transform:  scale(1.02);
    box-shadow: 0 12px 28px rgba(2, 167, 233, 0.35);
}

.appsheet-launch-button:active {
    transform: translateY(-1px) scale(0.99);
    box-shadow: 0 6px 16px rgba(2, 167, 233, 0.22);
}

.appsheet-launch-button .animation {
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    border-radius: 100%;
    background: rgba(252, 255, 51, 0.95);
    animation: ripple 0.6s linear infinite;
}

@keyframes ripple {
    0% {
        box-shadow: 0 0 0 0 rgba(252, 255, 51, 0.1), 0 0 0 20px rgba(252, 255, 51, 0.1), 0 0 0 40px rgba(252, 255, 51, 0.1), 0 0 0 60px rgba(252, 255, 51, 0.1);
    }

    100% {
        box-shadow: 0 0 0 20px rgba(252, 255, 51, 0.1), 0 0 0 40px rgba(252, 255, 51, 0.1), 0 0 0 60px rgba(252, 255, 51, 0.1), 0 0 0 80px rgba(252, 255, 51, 0);
    }
}

/* Data Grid */
.data-grid {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.last-update-box {
    padding: 14px 16px;
    border-radius: 12px;
    background: #fff5d8;
    box-shadow: 0px 0px 5px #0000001f;
    border: solid 1px darkgrey;
}

.last-update-title {
    font-size: 0.9rem;
    color: #7a8792;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.last-update-content {
    font-size: 0.95rem;
    color: #24313c;
    font-weight: 600;
    line-height: 1.5;
    white-space: pre-line;
    word-break: break-word;
}

.data-item {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 15px;
    padding-bottom: 8px;
    justify-content: space-between;
}

.data-item:last-child {
    border-bottom: none;
}

.data-label {
    font-size: 0.9rem;
    color: #888;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    min-width: 150px;
    /* Optional: aligns values if labels are similar length, remove if strict "immediately to right" is preferred. User said "subito a dx" so maybe no min-width? Let's remove min-width to be safe on "subito a dx" but usually lists look better aligned. User said "subito a dx" (immediately to right). So I will NOT enforce min-width. */
}

.data-value {
    font-size: 1rem;
    color: #333;
    font-weight: 600;
    word-break: break-word;
    line-height: 1.4;
    text-align: left;
}

.contacts-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    /* background-color: #f6f9ff; */
    box-shadow: 0px 0px 5px #0000003b;
}

.service-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.service-value {
    width: 100%;
}

.service-box-title {
    font-size: 0.9rem;
    color: #7a8792;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.service-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0px 18px;
    width: 100%;
    /* border: solid 1px #e4e4e4; */
    padding: 10px;
    border-radius: 10px;
    /* background-color: #f6f9ff; */
    box-shadow: 0px 0px 5px #0000003b;
}

.service-entry {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 10px;
    align-items: baseline;
    padding: 6px 0;
    border-bottom: 1px solid #eef3f7;
}

.service-entry:last-child {
    border-bottom: none;
}

.service-entry-label {
    font-size: 0.82rem;
    color: #7a8792;
    text-transform: uppercase;
    font-weight: 700;
}

.service-entry-value {
    font-size: 0.95rem;
    color: #24313c;
    font-weight: 600;
    word-break: break-word;
}

.contacts-value {
    width: 100%;
}

.contacts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    width: 100%;
}

.contacts-column {
    min-width: 0;
}

.contacts-entry {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
    padding: 6px 0;
    border-bottom: 1px solid #eef3f7;
}

.contacts-entry:last-child {
    border-bottom: none;
}

.contacts-entry-label {
    font-size: 0.8rem;
    color: #7a8792;
    text-transform: uppercase;
    font-weight: 700;
}

.contacts-entry-value {
    font-size: 0.95rem;
    color: #24313c;
    font-weight: 600;
    word-break: break-word;
}

/* Status Indicator */
.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.error-message,
.loading-message {
    text-align: center;
    color: #ffffff;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    backdrop-filter: blur(5px);
}

.hidden {
    display: none !important;
    /* Ensure it overrides display: flex of card-body if applied */
}

/* Specific styling for boolean/status values */
.value-true {
    color: #2e7d32;
}

.value-false {
    color: #c62828;
}

@media (max-width: 900px) {
    .card-body {
        flex-direction: column-reverse;
        /* Stack with image on top (or bottom?) - usually image top is better for mobile but user said data left, image right. Column reverse puts last element (image) first? No, column-reverse puts bottom element top.
        Wait, HTML structure: Data is first, Image is second.
        flex-direction: column; -> Data on top, Image on bottom.
        flex-direction: column-reverse; -> Image on top, Data on bottom.
        Typically images are nice headers on mobile. Let's try column-reverse so image is prominent? 
        Or just keep data first. Let's just do standard column. */
        flex-direction: column-reverse;
        gap: 30px;
    }

    .image-section {
        width: 100%;
        justify-content: center;
        align-items: center;
        /* Center on mobile */
        min-width: auto;
    }

    .data-section {
        width: 100%;
    }
}

@media (max-width: 600px) {
    header {
        padding: 15px 20px;
        gap: 16px;
        align-items: flex-start;
    }

    .header-left {
        min-width: 0;
    }

    .client-card {
        padding: 25px;
    }

    .client-name {
        font-size: 1.5rem;
    }

    .contacts-grid {
        grid-template-columns: 1fr;
    }

    .service-grid {
        grid-template-columns: 1fr;
    }

    .contact-list-button {
        font-size: 1rem;
    }
}
