/* --- Keep previous Root/Body/Container styles --- */
:root {
    --bg-level-1: #F0EEE9;
    --bg-level-2: #FDFCFB;
    --bg-input:   #F5F4F1;

    /* BRAND: PULSIFY BLUE */
    --primary-brand: #0084FF;
    --primary-hover: #0066CC;

    --success-green: #4A7C59;
    --info-accent: #0B5FFF;
    --text-main:  #2D2A26;
    --text-muted: #85807A;
    --border-subtle: rgba(0,0,0,0.06);

    --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.06),
                    inset 0 1px 2px rgba(0, 0, 0, 0.04),
                    0 1px 0 rgba(255, 255, 255, 1);

    --shadow-float: 0 20px 40px -5px rgba(45, 42, 38, 0.1),
                    0 10px 15px -3px rgba(45, 42, 38, 0.05);

    --btn-shadow: 0 4px 6px rgba(0, 132, 255, 0.25),
                  inset 0 1px 0 rgba(255, 255, 255, 0.2);

    --radius-lg: 24px;
    --radius-md: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-level-1);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 24px; max-width: 100%; }

/* Card Transitions */
.card {
    background-color: var(--bg-level-2);
    width: 100%;
    max-width: 420px;
    padding: 40px 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-float);
    position: relative;
    overflow: visible; 
    transition: max-width 0.8s cubic-bezier(0.22, 1, 0.36, 1), padding 0.6s ease;
}

.card.expanded { max-width: 680px; }

/* --- HEADER STYLES (Update this section) --- */
.card-header {
    margin-bottom: 32px;
    text-align: center;
}

/* 1. The Wrapper: Controls the position and maximum size */
.logo-frame {
    width: 70px;           /* FORCE the size here (try 56px or 64px) */
    height: auto;
    margin: 0 auto 20px;   /* Top:0, Left/Right:Auto (Centers it), Bottom:20px */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 2. The Image: Fills the wrapper completely */
.logo-img {
    width: 100%;           /* Take up 100% of the .logo-frame */
    height: auto;          /* Maintain aspect ratio so it doesn't squish */
    display: block;
    object-fit: contain;   /* Ensures clean rendering */
}

.card-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.card-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Slider */
.slider-viewport { width: 100%; overflow: hidden; border-radius: var(--radius-lg); }
.slider-track { display: flex; width: 200%; transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.slide { width: 50%; flex-shrink: 0; padding: 4px; display: flex; flex-direction: column; }

/* Inputs */
.input-group { margin-bottom: 20px; }
label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; margin-left: 4px; }
.req { color: var(--primary-brand); }

input {
    width: 100%; padding: 14px 16px; font-size: 1rem; border: none; border-radius: var(--radius-md);
    background-color: var(--bg-input); color: var(--text-main); font-family: inherit;
    box-shadow: var(--shadow-inset); transition: all 0.2s ease;
}
input:focus { outline: none; background-color: #fff; box-shadow: inset 0 1px 2px rgba(0,0,0,0.05), 0 0 0 3px rgba(0, 132, 255, 0.15); }

/* Placeholder: make placeholder text much more discreet */
input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.45; /* more discreet */
    transition: opacity 0.12s ease, color 0.12s ease;
}

/* Textareas should match input styling for a consistent, clean design */
textarea,
.credential-body textarea,
.json-textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius-md);
    background-color: var(--bg-input);
    color: var(--text-main);
    font-family: inherit;
    box-shadow: var(--shadow-inset);
    resize: vertical;
    min-height: 120px;
}
.json-textarea { max-height: 360px; }
textarea:focus,
.json-textarea:focus {
    outline: none;
    background-color: #fff;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05), 0 0 0 3px rgba(0, 132, 255, 0.12);
}
/* Vendor fallbacks */
input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { color: var(--text-muted); opacity: 0.45; }
input:-ms-input-placeholder, textarea:-ms-input-placeholder { color: var(--text-muted); opacity: 0.45; }
input::-ms-input-placeholder, textarea::-ms-input-placeholder { color: var(--text-muted); opacity: 0.45; }
.combined-input-wrapper input::placeholder { color: var(--text-muted); opacity: 0.45; }

/* --- MERGED PHONE INPUT STYLE --- */
.combined-input-wrapper {
    display: flex; align-items: center; width: 100%; border-radius: var(--radius-md);
    background-color: var(--bg-input); box-shadow: var(--shadow-inset); transition: all 0.2s ease;
    overflow: visible; position: relative;
}
.combined-input-wrapper:focus-within { background-color: #fff; box-shadow: inset 0 1px 2px rgba(0,0,0,0.05), 0 0 0 3px rgba(0, 132, 255, 0.15); }

.country-custom-select { position: relative; height: 100%; min-width: 115px; border-right: 1px solid rgba(0,0,0,0.06); }
.country-trigger {
    height: 100%; padding: 14px 12px 14px 16px; display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; font-size: 0.95rem; font-weight: 500; color: var(--text-main);
    border-top-left-radius: var(--radius-md); border-bottom-left-radius: var(--radius-md); transition: background 0.2s;
}
.country-trigger:hover { background-color: rgba(0,0,0,0.02); }
.custom-arrow-icon {
    width: 14px; height: 14px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232D2A26' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: center; background-size: contain; opacity: 0.6; transition: transform 0.3s;
}
.country-custom-select.active .custom-arrow-icon { transform: rotate(180deg); }
.country-options {
    position: absolute; top: 115%; left: 0; min-width: 140px; background-color: #fff;
    border-radius: var(--radius-md); box-shadow: 0 10px 25px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.05); z-index: 200;
    opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    max-height: 250px; overflow-y: auto;
}
.country-custom-select.active .country-options { opacity: 1; visibility: visible; transform: translateY(0); }
.country-option { padding: 10px 16px; cursor: pointer; font-size: 0.95rem; transition: background 0.1s; color: var(--text-main); }
.country-option:hover { background-color: var(--bg-level-1); color: var(--primary-brand); }
.combined-input-wrapper input { background-color: transparent; box-shadow: none; border: none; border-radius: 0; padding-left: 16px; padding-right: 16px; flex-grow: 1; }
.combined-input-wrapper input:focus { background-color: transparent; box-shadow: none; outline: none; }

/* Portal Dropdown */
.dropdown-portal {
    position: fixed; z-index: 9999; background-color: #fff; border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
    opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    max-height: 250px; overflow-y: auto; min-width: 140px;
}
.dropdown-portal.open { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-portal::-webkit-scrollbar { width: 6px; }
.dropdown-portal::-webkit-scrollbar-track { background: transparent; }
.dropdown-portal::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,0.1); border-radius: 4px; }

/* API Selector */
.custom-dropdown { position: relative; width: 100%; margin-bottom: 24px; font-family: 'Inter', sans-serif; }
.dropdown-trigger {
    width: 100%; padding: 14px 16px; font-size: 1rem; font-weight: 500; border-radius: var(--radius-md);
    background-color: var(--bg-input); color: var(--text-muted); box-shadow: var(--shadow-inset);
    cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: all 0.2s;
}
.dropdown-trigger:hover { background-color: #fff; }
.dropdown-trigger.active { background-color: #fff; color: var(--text-main); }
.dropdown-arrow { font-size: 0.8rem; opacity: 0.6; transition: transform 0.3s; }
.dropdown-trigger.open .dropdown-arrow { transform: rotate(180deg); }
.dropdown-options {
    position: absolute; top: 110%; left: 0; width: 100%; background-color: #fff; border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.05); z-index: 100;
    opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    max-height: 250px; overflow-y: auto;
}
.dropdown-trigger.open + .dropdown-options { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-option { padding: 12px 16px; cursor: pointer; transition: background 0.1s; display: flex; align-items: center; gap: 8px; font-size: 0.95rem; }
.dropdown-option:hover { background-color: var(--bg-level-1); }
.dropdown-option span { font-size: 1.1rem; }

/* Credential Cards */
#credentialsList { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.credential-card {
    background: #fff; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; 
    transition: all 0.3s ease; box-shadow: 0 2px 5px rgba(0,0,0,0.02); opacity: 0.85; 
}
.credential-card.is-open { opacity: 1; border-color: rgba(0,0,0,0.1); box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.credential-header {
    display: flex; align-items: center; gap: 12px; padding: 16px 20px; cursor: pointer;
    background: transparent; transition: background 0.2s; user-select: none;
}
.credential-header:hover { background-color: var(--bg-level-1); }
.service-icon { width: 32px; height: 32px; background-color: var(--bg-level-1); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.service-title { font-weight: 600; font-size: 0.95rem; flex-grow: 1; }
.remove-btn { background: none; border: none; color: var(--text-muted); font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 4px; margin-left: 8px; opacity: 0.4; z-index: 2; transition: all 0.2s; }
.remove-btn:hover { opacity: 1; color: var(--primary-brand); transform: scale(1.1); }
.credential-body { padding: 0 20px; max-height: 0; overflow: hidden; opacity: 0; transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1); }
.credential-card.is-open .credential-body { padding-bottom: 20px; max-height: 500px; opacity: 1; }
@keyframes shake { 0% { transform: translateX(0); } 25% { transform: translateX(-4px) rotate(-1deg); } 50% { transform: translateX(4px) rotate(1deg); } 75% { transform: translateX(-2px); } 100% { transform: translateX(0); } }
.credential-card.shake-it { animation: shake 0.6s ease-in-out; }

/* Buttons */
.button-row { display: flex; gap: 12px; margin-top: 12px; }
.cta-button {
    width: 100%; padding: 16px; margin-top: 12px; background-color: var(--primary-brand);
    color: white; font-size: 1rem; font-weight: 600; border: none; border-radius: var(--radius-md);
    cursor: pointer; box-shadow: var(--btn-shadow); transition: transform 0.1s ease, background-color 0.2s;
}
.cta-button:hover { background-color: var(--primary-hover); transform: translateY(-1px); }
.cta-button.loading { background-color: var(--text-muted); pointer-events: none; }

.secondary-button {
    width: 30%; padding: 16px; margin-top: 12px; background-color: transparent;
    color: var(--text-muted); font-size: 1rem; font-weight: 600; border: 1px solid transparent;
    border-radius: var(--radius-md); cursor: pointer; transition: all 0.2s;
}
.secondary-button:hover { background-color: var(--bg-level-1); color: var(--text-main); }

/* Success */
.success-view { display: none; flex-direction: column; align-items: center; text-align: center; padding: 20px 0; animation: fadeIn 0.5s ease; }
.success-icon {
    width: 56px; height: 56px; background-color: var(--info-accent); color: white;
    border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; margin-bottom: 18px; box-shadow: 0 6px 18px rgba(11, 95, 255, 0.12);
}
.success-view .email-highlight { display:block; margin-top:8px; font-weight:700; color:var(--primary-brand); text-align:center; }
/* Confirmation modal */
.confirm-modal{ position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(12,12,12,0.45); opacity: 0; visibility: hidden; transition: opacity 0.18s ease, visibility 0.18s; z-index: 12000; }
.confirm-modal.open{ opacity: 1; visibility: visible; }
.confirm-modal__box{ background: #fff; padding: 22px; border-radius: 12px; max-width: 520px; width: 92%; box-shadow: 0 20px 40px rgba(0,0,0,0.12); text-align: center; }
.confirm-modal__box p{ margin: 0 0 14px; color: var(--text-main); font-size: 1rem; line-height: 1.4; }
.confirm-modal__actions{ display: flex; gap: 10px; justify-content: center; }
.confirm-modal__actions .secondary-button{ width: auto; padding: 10px 14px; }
.confirm-modal__actions .cta-button{ width: auto; padding: 10px 14px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }