/*
 * AI Friends CSS
 */

.aifl-main {
    min-height: 100svh;
    padding-top: max(5.5rem, calc(4.5rem + env(safe-area-inset-top)));
    padding-bottom: 80px;
    position: relative;
}

.aifl-shell {
    position: relative;
    z-index: 1;
}

.aifl-hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    padding: 1.75rem 0 1.25rem;
    margin-bottom: 1.25rem;
}

.aifl-hero-copy {
    max-width: 680px;
}

.aifl-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(111, 152, 255, 0.18);
    background: rgba(12, 16, 28, 0.6);
    color: #dbe5ff;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    backdrop-filter: blur(16px);
}

.aifl-title {
    margin: 14px 0 8px;
    color: #f5f7ff;
    font-size: clamp(2rem, 4.4vw, 3.2rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
}

.aifl-subtitle {
    margin: 0;
    max-width: 560px;
    color: rgba(219, 229, 255, 0.72);
    font-size: 0.98rem;
    line-height: 1.65;
}

.aifl-hero-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(111, 152, 255, 0.18);
    background: rgba(10, 14, 24, 0.82);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
    color: #dbe5ff;
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
}

.aifl-login-card {
    text-align: center;
    padding: 44px 24px;
    background: rgba(18, 18, 22, 0.7);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(111, 152, 255, 0.12);
    border-radius: 28px;
    margin-bottom: 40px;
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.28);
}

.friends-grid.aifl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 20px;
}

.friend-card {
    position: relative;
    overflow: hidden;
    border-radius: 26px;
    aspect-ratio: 3 / 4;
}

.aifl-create-card {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 22px;
    border: 1px dashed rgba(111, 152, 255, 0.28);
    background:
        radial-gradient(circle at top, rgba(111, 152, 255, 0.14), transparent 55%),
        linear-gradient(180deg, rgba(18, 24, 39, 0.94), rgba(10, 12, 22, 0.96));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 18px 36px rgba(0, 0, 0, 0.22);
    text-align: center;
}

.aifl-create-card:focus-visible {
    border-color: rgba(127, 169, 255, 0.5);
    outline: none;
}

.aifl-create-icon-shell {
    width: 66px;
    height: 66px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(111, 152, 255, 0.12);
    border: 1px solid rgba(111, 152, 255, 0.22);
}

.aifl-create-title {
    margin: 0;
    color: #f4f7ff;
    font-size: 1.12rem;
    font-weight: 800;
}

.aifl-create-copy {
    margin: 0;
    color: rgba(214, 221, 240, 0.72);
    font-size: 0.87rem;
    line-height: 1.55;
}

.aifl-friend-card {
    cursor: pointer;
    background: #11141d;
    border: 1px solid rgba(111, 152, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 14px 30px rgba(0, 0, 0, 0.26);
}

.aifl-friend-card:focus-visible {
    border-color: rgba(127, 169, 255, 0.5);
    outline: none;
}

.aifl-friend-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.aifl-friend-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, rgba(7, 9, 16, 0.98) 0%, rgba(7, 9, 16, 0.74) 38%, rgba(7, 9, 16, 0.12) 66%),
        linear-gradient(180deg, rgba(111, 152, 255, 0.06), transparent 30%);
}

.aifl-friend-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 14px;
}

.aifl-friend-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.aifl-friend-name {
    margin: 0;
    color: #fff;
    font-size: 1.28rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.aifl-friend-tagline {
    margin: 0;
    color: rgba(232, 237, 250, 0.7);
    font-size: 0.82rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aifl-friend-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.aifl-primary-action {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, #ffffff, #dce7ff);
    color: #09090b;
    font-size: 0.85rem;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 6px 14px rgba(255, 255, 255, 0.1);
}

.aifl-delete-btn {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    background: rgba(7, 11, 20, 0.6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.aifl-delete-btn:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    outline: none;
}

/* Wizard Animations & Effects */
.wizard-container {
    animation: wizUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes wizUp {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.wizard-step {
    animation: stepFade 0.3s ease forwards;
}

@keyframes stepFade {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

.hover-border-indigo:hover {
    border-color: #818cf8 !important;
    background: rgba(129, 140, 248, 0.05);
}

.trait-card:has(input:checked) {
    border-color: #818cf8 !important;
    background: rgba(129, 140, 248, 0.1) !important;
    box-shadow: 0 0 15px rgba(129, 140, 248, 0.1);
}

.voice-card:has(input:checked) {
    border-color: #818cf8 !important;
    background: rgba(129, 140, 248, 0.1) !important;
    box-shadow: 0 0 15px rgba(129, 140, 248, 0.1);
}

.voice-card:hover:not(:has(input:checked)) {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.voice-play-btn:hover {
    background: rgba(255, 255, 255, 0.18) !important;
}

.voice-play-btn.playing {
    background: #818cf8 !important;
}

.voice-play-btn:disabled,
.voice-play-btn.loading {
    opacity: 0.55;
    cursor: wait;
}

/* Common form utilities */
.wz-effect-checkbox:checked + .effect-chip {
    border-color: #818cf8;
    color: #818cf8;
}

/* Avatar Upload Animation */
@keyframes spinRing {
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}

.upload-spinner-ring {
    animation: spinRing 1s linear infinite;
    transform-origin: center;
}

.upload-progress-track {
    width: 100%;
    max-width: 180px;
    height: 4px;
    background: rgba(129, 140, 248, 0.15);
    border-radius: 999px;
    margin: 0 auto;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    width: 55%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(129, 140, 248, 0.6) 30%,
        #818cf8 50%,
        rgba(129, 140, 248, 0.6) 70%,
        transparent 100%
    );
    border-radius: 999px;
    animation: shimmer 1.4s ease-in-out infinite;
}

.avatar-card-uploading {
    border-color: #818cf8 !important;
    background: rgba(129, 140, 248, 0.07) !important;
    pointer-events: none;
    cursor: default;
}

@media (max-width: 900px) {
    .aifl-hero {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .friends-grid.aifl-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .friend-card {
        aspect-ratio: 2 / 3;
    }

    .aifl-create-card {
        min-height: 180px;
        padding: 18px 14px;
    }

    .aifl-friend-content {
        padding: 12px;
    }

    .aifl-friend-name {
        font-size: 1.08rem;
    }

    .aifl-friend-tagline {
        font-size: 0.76rem;
    }

    .aifl-primary-action,
    .aifl-delete-btn {
        min-height: 38px;
    }

    .wizard-container {
        height: 100svh;
        max-height: 100svh;
        border-radius: 0;
        border: none;
    }
}
