/* ===========================================
   CSS VARIABLES
   =========================================== */

:root {
    /* Colors */
    --color-primary: #bf5aa2;
    --color-secondary: #57c7d6;
    --color-bg: #faf8fc;
    --color-text: #4868ac;
    --color-card-bg: #faf8fc;
    --color-btn-text: #f3ecec;

    /* Semantic colors */
    --color-success: #27AE60;
    --color-error: #E74C3C;
    --color-warning: #F39C12;
    --color-info: #3498DB;

    /* Typography */
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Font sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.5rem;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
    --card-radius: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.3);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Z-index */
    --z-dropdown: 100;
    --z-modal: 200;
    --z-toast: 300;
}

/* ===========================================
   RESET & BASE
   =========================================== */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

body.app-body {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('/img/background.png') center/cover no-repeat;
    filter: blur(2px);
    z-index: -1;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

a:hover { opacity: 0.8; }

/* ===========================================
   MAIN LAYOUT
   =========================================== */

.main-content {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.app-body .main-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ===========================================
   PROFILE CONTAINER
   =========================================== */

.profile-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* ===========================================
   PROFILE LOGO
   =========================================== */

.profile-logo {
    text-align: center;
    margin-bottom: 20px;
}

.profile-logo img {
    max-width: 150px;
    height: auto;
    object-fit: contain;
}

[data-logo-size="small"] .profile-logo img { max-width: 100px; }
[data-logo-size="medium"] .profile-logo img { max-width: 150px; }
[data-logo-size="large"] .profile-logo img { max-width: 200px; }
[data-logo-size="xlarge"] .profile-logo img { max-width: 280px; }
[data-logo-position="hidden"] .profile-logo { display: none; }

.profile-logo-top { margin-bottom: var(--space-4); }
.profile-logo-header { margin-bottom: var(--space-4); }

/* ===========================================
   PROFILE HEADER
   =========================================== */

.profile-header {
    text-align: center;
    padding: 40px 24px 32px;
    background: linear-gradient(
        180deg,
        rgba(191, 90, 162, 0.08) 0%,
        transparent 100%
    );
    border-radius: 16px;
    margin-bottom: 16px;
}

.photo-container {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--color-primary);
    background: var(--color-card-bg);
}

.photo-container.hidden { display: none; }

.photo-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 15%;
}

.profile-name {
    font-size: 28px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 8px;
    letter-spacing: -0.5px;
}

.profile-role {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-primary);
    margin: 0 0 4px;
}

.profile-company {
    font-size: 14px;
    color: var(--color-text);
    opacity: 0.7;
    margin: 0 0 8px;
}

.profile-tagline {
    font-size: 14px;
    font-style: italic;
    color: var(--color-text);
    opacity: 0.6;
    margin: 12px 0 0;
}

/* ===========================================
   INFO SECTION
   =========================================== */

.info-section {
    padding: 0;
}

.info-card {
    background: var(--color-card-bg);
    border: 1.5px solid rgba(67, 106, 179, 0.35);
    border-radius: 16px;
    padding: 8px 0;
}

/* ===========================================
   INFO ITEMS
   =========================================== */

.info-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    transition: background 0.2s ease;
    cursor: default;
}

.info-item:hover {
    background: rgba(191, 90, 162, 0.04);
}

.info-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(191, 90, 162, 0.1);
    border-radius: 10px;
}

.info-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-primary);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.info-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.info-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text);
    opacity: 0.5;
}

.info-value {
    font-size: 15px;
    color: var(--color-text);
    word-break: break-word;
}

.info-link {
    color: var(--color-text);
    text-decoration: none;
    transition: color 0.2s ease;
}

.info-link:hover {
    color: var(--color-primary);
}

/* ===========================================
   COPY BUTTON
   =========================================== */

.copy-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(191, 90, 162, 0.05);
    border: 1px solid rgba(191, 90, 162, 0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn svg {
    width: 16px;
    height: 16px;
    stroke: var(--color-text);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.copy-btn:hover {
    background: rgba(191, 90, 162, 0.12);
    border-color: rgba(191, 90, 162, 0.3);
}

.copy-btn:hover svg { opacity: 1; }

.copy-btn.copied {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.4);
}

.copy-btn.copied svg {
    stroke: #4CAF50;
    opacity: 1;
}

/* ===========================================
   DOWNLOAD SECTION
   =========================================== */

.download-section {
    padding: 0;
    margin-top: 16px;
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 18px 24px;
    background: var(--color-primary);
    color: var(--color-btn-text);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.download-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(191, 90, 162, 0.3);
}

.download-btn svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-btn-text);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ===========================================
   QR SECTION (profile page)
   =========================================== */

.qr-section {
    text-align: center;
    margin: 24px 0;
}

.qr-section h3 {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--color-primary);
    opacity: 0.7;
    margin-bottom: 16px;
}

#qrcode-profile {
    background: #FFFFFF;
    padding: 15px;
    border-radius: 12px;
    display: inline-block;
}

/* ===========================================
   TOAST
   =========================================== */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    background: rgba(72, 104, 172, 0.9);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: var(--z-toast);
    pointer-events: none;
}

.toast.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ===========================================
   FOOTER
   =========================================== */

.footer {
    text-align: center;
    padding: var(--space-4);
    font-size: var(--text-sm);
    opacity: 0.6;
}

.app-body .footer {
    padding: var(--space-2) var(--space-4);
    flex-shrink: 0;
}

.footer a {
    color: var(--color-primary);
}

/* ===========================================
   FORMS (app.html login)
   =========================================== */

.login-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

.login-card {
    background: var(--color-card-bg);
    padding: var(--space-8);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-xl);
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.login-title {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--color-text);
}

.form-group {
    margin-bottom: var(--space-4);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 500;
    opacity: 0.8;
}

.form-group input {
    width: 100%;
    padding: var(--space-3);
    font-family: var(--font-body);
    font-size: var(--text-base);
    background: var(--color-card-bg);
    color: var(--color-text);
    border: 1px solid rgba(72, 104, 172, 0.15);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-group input::placeholder { opacity: 0.5; }

.form-error {
    color: var(--color-error);
    font-size: var(--text-sm);
    margin-top: var(--space-2);
    display: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    width: 100%;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-btn-text);
    padding: 16px 24px;
    font-weight: 600;
    border-radius: 16px;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(191, 90, 162, 0.05);
    color: var(--color-text);
    border: 1px solid rgba(191, 90, 162, 0.15);
    padding: 12px 24px;
    border-radius: 16px;
    margin-top: 12px;
}

.btn-secondary:hover {
    background: rgba(191, 90, 162, 0.1);
}

/* ============================================
   BUSINESS CARD STYLES
   ============================================ */

.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
}
.hidden { display: none !important; }

.user-card-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

/* LOGO (above card) */
.card-logo {
    text-align: center;
    flex-shrink: 0;
}
.card-logo img {
    max-width: 180px;
    max-height: 120px;
    object-fit: contain;
}

/* CARD CONTAINER */
.business-card-container {
    perspective: 1000px;
    width: 100%;
    max-width: 340px;
}

/* CARD FLIPPER */
.business-card-flipper {
    position: relative;
    width: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    cursor: pointer;
}
.business-card-container.flipped .business-card-flipper {
    transform: rotateY(180deg);
}

/* CARD DIMENSIONS (vertical) */
.business-card-container.vertical .business-card-flipper {
    height: min(420px, calc(100dvh - 200px));
}

/* CARD FACE */
.business-card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 16px;
    overflow: hidden;
    background: var(--color-card-bg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* VERTICAL FRONT */
.business-card-container.vertical .business-card-front {
    display: flex;
    flex-direction: column;
    padding: 28px 24px 24px;
    position: relative;
}
.business-card-container.vertical .card-avatar-section {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}
.business-card-container.vertical .card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: center;
}
.business-card-container.vertical .card-identity { margin-bottom: 16px; }
.business-card-container.vertical .card-name {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--color-text);
}
.business-card-container.vertical .card-role {
    font-size: 17px;
    font-weight: 500;
    margin: 0 0 4px;
    color: var(--color-primary);
}
.business-card-container.vertical .card-company {
    font-size: 15px;
    margin: 0;
    color: var(--color-text);
    opacity: 0.6;
}
.business-card-container.vertical .card-info { margin-top: auto; }
.business-card-container.vertical .info-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 15px;
    color: var(--color-text);
}

/* AVATAR */
.card-avatar {
    border: 3px solid var(--color-primary);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 0;
}
.card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ICONS */
.info-row svg {
    width: 18px;
    height: 18px;
    stroke: var(--color-primary);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* HINT */
.card-hint {
    display: none;
}

/* BACK SIDE */
.business-card-back {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotateY(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
}
.qr-container { text-align: center; }
#qrcode-card {
    background: #FFFFFF;
    padding: 15px;
    border-radius: 12px;
    display: inline-block;
}
#qrcode-card img { display: block; }
.qr-subtitle {
    margin-top: 12px;
    font-size: 12px;
    color: var(--color-text);
    opacity: 0.5;
}

/* LOGOUT */
.btn-logout {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(191, 90, 162, 0.1);
    color: var(--color-text);
    border: 1px solid rgba(191, 90, 162, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-logout:hover {
    background: rgba(191, 90, 162, 0.2);
}
.btn-logout svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-text);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 480px) {
    .profile-container { padding: 12px; }

    .profile-header { padding: 32px 20px 24px; }

    .photo-container { width: 100px; height: 100px; }

    .profile-name { font-size: 24px; }

    .info-item { padding: 14px 16px; gap: 12px; }

    .info-icon { width: 36px; height: 36px; }
    .info-icon svg { width: 18px; height: 18px; }

    .copy-btn { width: 32px; height: 32px; }

    .download-btn { padding: 16px 20px; font-size: 14px; }

    .login-card { padding: var(--space-5); }
}
