:root {
    /* Light Mode Variables */
    --bg-color: #f2f2f7;
    --card-bg: rgba(255, 255, 255, 0.6);
    --text-primary: #1c1c1e;
    --text-secondary: #8e8e93;
    --accent-color: #007aff;
    --glass-border: rgba(255, 255, 255, 0.4);
    --item-bg: #ffffff;
    --item-hover: #f8f8fb;
    --btn-text: #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark Mode Variables */
        --bg-color: #000000;
        --card-bg: #1c1c1e;
        --text-primary: #ffffff;
        --text-secondary: #aeaeb2;
        --accent-color: #0a84ff;
        --glass-border: rgba(255, 255, 255, 0.1);
        --item-bg: #2c2c2e;
        --item-hover: #3a3a3c;
        --btn-text: #000000;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.card-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: row; /* Desktop layout: Side by side */
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ====== DESKTOP LAYOUT (Default) ====== */

.card-left {
    width: 35%;
    min-width: 400px;
    max-width: 550px;
    background-color: var(--card-bg);
    display: flex;
    flex-direction: column;
    padding: 60px 40px;
    box-shadow: 15px 0 40px rgba(0, 0, 0, 0.15);
    z-index: 10;
    overflow-y: auto;
}

@media (prefers-color-scheme: dark) {
    .card-left {
        box-shadow: 15px 0 40px rgba(0, 0, 0, 0.8);
    }
}

.banner-container-mobile {
    display: none; /* Hidden on PC */
}

.profile-container {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    position: relative;
    z-index: 10;
}

.profile-pic-wrapper {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    padding: 8px;
    background: var(--bg-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.profile-pic-wrapper img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.identity-container {
    text-align: center;
    margin-bottom: 40px;
}

.name {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.company {
    font-size: 1.15rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.contact-section {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: flex-start;
}

.contact-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 40px;
}

.contact-item {
    display: flex;
    align-items: center;
    background: var(--item-bg);
    border: 1px solid var(--glass-border);
    padding: 18px 20px;
    border-radius: 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.contact-item:active {
    background: var(--item-hover);
    transform: scale(0.97);
}

@media (hover: hover) {
    .contact-item:hover {
        background: var(--item-hover);
        transform: translateY(-3px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    }
    
    .add-button:hover {
        opacity: 0.9;
        transform: translateY(-3px);
        box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2);
    }
}

.icon-wrapper {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: var(--accent-color);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    margin-right: 20px;
    flex-shrink: 0;
    box-shadow: 0 6px 15px rgba(0, 122, 255, 0.3);
}

.contact-text {
    display: flex;
    flex-direction: column;
    text-align: left;
    overflow: hidden;
    flex-grow: 1;
}

.contact-text .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    margin-bottom: 4px;
}

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

.add-button {
    width: 100%;
    background: var(--text-primary);
    color: var(--btn-text);
    border: none;
    padding: 20px;
    border-radius: 20px;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    margin-top: auto; /* Pushes button to bottom if there's space */
}

.add-button ion-icon {
    font-size: 1.5rem;
}

.add-button:active {
    transform: scale(0.96);
    opacity: 0.8;
}

/* Right Side - Visual / Map */
.card-right {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-color);
}

.desktop-banner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-overlay-desktop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.5) 100%);
}

.map-container {
    position: absolute;
    bottom: 40px;
    right: 40px;
    width: 400px;
    height: 280px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    border: 3px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}


/* ====== MOBILE LAYOUT ====== */
@media (max-width: 850px) {
    .card-container {
        flex-direction: column;
    }

    .card-left {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        padding: 0;
        box-shadow: none;
        background: transparent;
        overflow: visible;
    }

    .banner-container-mobile {
        display: block;
        position: relative;
        height: 200px;
        width: 100%;
    }

    .banner-container-mobile img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .banner-overlay-mobile {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60%;
        background: linear-gradient(to top, var(--bg-color) 0%, transparent 100%);
    }

    .profile-container {
        margin-top: -80px;
        justify-content: center;
    }

    .profile-pic-wrapper {
        width: 150px;
        height: 150px;
        background: var(--bg-color);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
        padding: 6px;
    }

    .identity-container {
        margin-bottom: 30px;
        padding: 0 20px;
    }

    .contact-section {
        padding: 0 20px 40px;
    }

    .contact-list {
        margin-bottom: 30px;
    }
    
    .contact-item {
        padding: 14px 16px;
    }
    
    .icon-wrapper {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
        margin-right: 16px;
    }
    
    .contact-text .value {
        font-size: 1rem;
    }
    
    .add-button {
        padding: 18px;
        font-size: 1.1rem;
        margin-top: 0;
    }

    .card-right {
        display: none; /* Hide desktop banner and map on mobile completely */
    }
}

/* Toast Notification */
.toast-message {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-color);
    padding: 16px 20px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    width: 90%;
    max-width: 400px;
    font-weight: 500;
    font-size: 0.95rem;
    pointer-events: none;
}

.toast-message.show {
    bottom: 30px;
    opacity: 1;
    visibility: visible;
}

.toast-message ion-icon {
    font-size: 1.8rem;
    color: var(--bg-color);
}

/* Animations */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-element {
    opacity: 0;
    animation: fadeSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* Social Icons */
.social-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.social-icon:hover {
    transform: translateY(-3px);
    background: var(--accent-color);
    color: white;
    box-shadow: 0 8px 20px rgba(0, 122, 255, 0.3);
}

@media (prefers-color-scheme: dark) {
    .social-icon {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.05);
    }
}

/* Share Button */
.share-button {
    width: 100%;
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px;
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.share-button ion-icon {
    font-size: 1.4rem;
}

.share-button:hover {
    background: var(--text-primary);
    color: var(--bg-color);
    transform: scale(0.98);
}

@media (prefers-color-scheme: dark) {
    .share-button {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.05);
    }
}

/* Share Modal */
.share-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.share-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.share-modal {
    background: var(--bg-color);
    padding: 30px;
    border-radius: 24px;
    width: 90%;
    max-width: 350px;
    text-align: center;
    position: relative;
    transform: translateY(50px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.share-modal-overlay.active .share-modal {
    transform: translateY(0) scale(1);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: var(--text-primary);
}

.share-modal h2 {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.share-modal p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 25px;
}

.qr-container {
    background: white;
    padding: 15px;
    border-radius: 16px;
    display: inline-block;
    margin-bottom: 25px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.qr-container img {
    display: block;
    width: 180px;
    height: 180px;
}

.native-share-btn {
    width: 100%;
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

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