/* =========================================================
   PROFILE PAGE STYLES
   Extends sermons.css — reuses palette (#6B3FA0 / #5A2E8A)
   ========================================================= */

:root {
    --sermon-purple: #6B3FA0;
    --sermon-purple-deep: #5A2E8A;
    --sermon-purple-soft: #9B6FC0;
    --sermon-ink: #1E1A1A;
    --sermon-mute: #8A7A7A;
    --sermon-line: #EFEAE4;
    --sermon-surface: #FFFFFF;
    --sermon-bg: #F8F4EE;
    --sermon-shadow: 0 10px 30px rgba(107, 63, 160, 0.08);
    --sermon-shadow-lg: 0 18px 48px rgba(90, 46, 138, 0.18);
    --ease: cubic-bezier(.22, .61, .36, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--sermon-bg);
    color: var(--sermon-ink);
    min-height: 100vh;
    padding: 24px;
}

@media (max-width: 480px) {
    body {
        padding: 16px;
    }
}

/* =========================================================
   PROFILE HEADER
   ========================================================= */
.profile-header {
    position: relative;
    background:
        radial-gradient(1200px 500px at 90% -20%, rgba(255, 255, 255, .18), transparent 60%),
        linear-gradient(145deg, #4A2478 0%, #6B3FA0 55%, #9B6FC0 100%);
    padding: 56px 32px 48px;
    border-radius: 0 0 36px 36px;
    color: #fff;
    overflow: hidden;
    margin-bottom: 28px;
    box-shadow: 0 12px 40px rgba(74, 36, 120, 0.25);
    animation: profileFadeUp .6s var(--ease) both;
}

@media (max-width: 640px) {
    .profile-header {
        padding: 32px 16px 32px;
        border-radius: 0 0 24px 24px;
        margin-bottom: 20px;
    }
}

.profile-header__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
    position: relative;
    z-index: 2;
}

@media (max-width: 640px) {
    .profile-header__inner {
        gap: 20px;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, .3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
    transition: transform .3s var(--ease);
}

@media (max-width: 480px) {
    .profile-avatar {
        width: 96px;
        height: 96px;
        font-size: 36px;
    }
}

.profile-avatar:hover {
    transform: scale(1.05);
}

.profile-avatar__badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: var(--sermon-purple);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: 2px solid #fff;
}

@media (max-width: 480px) {
    .profile-avatar__badge {
        width: 28px;
        height: 28px;
        font-size: 10px;
    }
}

.profile-info {
    flex: 1;
    min-width: 200px;
}

@media (max-width: 640px) {
    .profile-info {
        min-width: unset;
        width: 100%;
    }
}

.profile-info h1 {
    font-size: clamp(28px, 3.5vw, 42px);
    font-weight: 700;
    letter-spacing: -0.8px;
    margin: 0 0 8px;
}

.profile-info p {
    font-size: clamp(14px, 1.2vw, 16px);
    opacity: .85;
    margin: 0 0 16px;
    max-width: 500px;
}

@media (max-width: 640px) {
    .profile-info p {
        max-width: 100%;
        margin: 0 0 12px;
    }
}

.profile-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .profile-meta {
        gap: 12px;
        justify-content: center;
    }
}

.profile-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    opacity: .9;
}

.profile-meta-item i {
    font-size: 14px;
}

#logoutBtn {
    margin-left: auto;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .3);
    padding: 10px 20px;
    border-radius: 12px;
    font: 600 14px 'Inter', sans-serif;
    cursor: pointer;
    transition: all .2s var(--ease);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#logoutBtn:hover {
    background: rgba(255, 255, 255, .25);
    transform: translateY(-2px);
}

@media (max-width: 640px) {
    #logoutBtn {
        margin: 0 auto;
        width: 100%;
        justify-content: center;
    }
}

/* =========================================================
   PROFILE LAYOUT
   ========================================================= */
.profile-layout {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 28px;
}

@media (max-width: 900px) {
    .profile-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* =========================================================
   PROFILE CARDS
   ========================================================= */
.profile-card {
    background: #fff;
    border-radius: 24px;
    border: 1px solid var(--sermon-line);
    padding: 28px 32px;
    margin-bottom: 20px;
    box-shadow: var(--sermon-shadow);
    transition: transform .3s var(--ease), box-shadow .3s var(--ease);
    animation: profileFadeUp .5s var(--ease) both;
}

@media (max-width: 480px) {
    .profile-card {
        padding: 20px;
        border-radius: 18px;
        margin-bottom: 16px;
    }
}

.profile-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sermon-shadow-lg);
}

.profile-card__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--sermon-ink);
    margin: 0 0 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-card__title i {
    color: var(--sermon-purple);
}

.profile-card__title .badge {
    margin-left: auto;
    font-size: 12px;
    font-weight: 500;
    color: var(--sermon-mute);
    background: var(--sermon-bg);
    padding: 4px 12px;
    border-radius: 999px;
}

@media (max-width: 480px) {
    .profile-card__title .badge {
        margin-left: 0;
    }
}

/* =========================================================
   PROFILE FORM
   ========================================================= */
.profile-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--sermon-ink);
}

.form-group input,
.form-group textarea {
    padding: 12px 16px;
    border: 1px solid var(--sermon-line);
    border-radius: 12px;
    font: 400 14px/1.5 'Inter', sans-serif;
    color: var(--sermon-ink);
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: 0;
    border-color: var(--sermon-purple);
    box-shadow: 0 0 0 4px rgba(107, 63, 160, .1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn-primary,
.btn-outline,
.btn-ghost {
    font: 600 14px 'Inter', sans-serif;
    border-radius: 12px;
    padding: 12px 22px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all .2s var(--ease);
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--sermon-purple-deep), var(--sermon-purple));
    color: #fff;
    box-shadow: 0 8px 22px rgba(107, 63, 160, .25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(107, 63, 160, .32);
}

.btn-primary:active {
    transform: scale(.97);
}

.btn-outline {
    background: transparent;
    color: var(--sermon-purple-deep);
    border-color: var(--sermon-line);
}

.btn-outline:hover {
    border-color: var(--sermon-purple);
    background: rgba(107, 63, 160, .05);
}

.btn-ghost {
    background: rgba(107, 63, 160, .08);
    color: var(--sermon-purple-deep);
}

.btn-ghost:hover {
    background: rgba(107, 63, 160, .14);
}

@media (max-width: 480px) {
    .btn-primary,
    .btn-outline,
    .btn-ghost {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
    }
}

/* =========================================================
   BILLING
   ========================================================= */
.billing-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.billing-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--sermon-line);
}

.billing-item:last-child {
    border-bottom: 0;
}

.billing-label {
    font-size: 14px;
    color: var(--sermon-mute);
}

.billing-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--sermon-ink);
}

.billing-value.status-active {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #2E7D32;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
    display: inline-block;
}

/* =========================================================
   DOWNLOADS
   ========================================================= */
.downloads-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.download-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--sermon-bg);
    border-radius: 12px;
    transition: transform .2s var(--ease);
}

.download-item:hover {
    transform: translateX(4px);
}

.download-item__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(107, 63, 160, .1);
    color: var(--sermon-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.download-item__info {
    flex: 1;
    min-width: 0;
}

.download-item__info h5 {
    font-size: 14px;
    font-weight: 500;
    color: var(--sermon-ink);
    margin: 0 0 2px;
}

.download-item__info p {
    font-size: 12px;
    color: var(--sermon-mute);
    margin: 0;
}

.download-item__size {
    font-size: 12px;
    color: var(--sermon-mute);
    background: #fff;
    padding: 2px 10px;
    border-radius: 999px;
}

/* =========================================================
   STATS
   ========================================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-item {
    text-align: center;
    padding: 16px 8px;
    background: var(--sermon-bg);
    border-radius: 12px;
}

.stat-number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--sermon-purple-deep);
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--sermon-mute);
    margin-top: 4px;
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .stat-number {
        font-size: 22px;
    }
}

/* =========================================================
   TOAST
   ========================================================= */
.toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: var(--sermon-ink);
    color: #fff;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 1000;
    max-width: 400px;
    animation: toastIn .3s var(--ease) both;
}

.toast button {
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, .6);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
}

.toast button:hover {
    color: #fff;
}

@media (max-width: 480px) {
    .toast {
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: unset;
        padding: 14px 18px;
    }
}

/* =========================================================
   ANIMATIONS
   ========================================================= */
@keyframes profileFadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 576px) {
    .profile-header {
        padding: 24px 12px 28px;
        border-radius: 0 0 20px 20px;
    }

    .profile-card {
        padding: 16px;
        border-radius: 16px;
    }

    .profile-avatar {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }

    .profile-avatar__badge {
        width: 24px;
        height: 24px;
        font-size: 9px;
    }

    .profile-info h1 {
        font-size: 24px;
    }

    .profile-meta-item {
        font-size: 12px;
    }

    .billing-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .download-item {
        flex-wrap: wrap;
    }

    .download-item__size {
        margin-left: auto;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    .profile-card:hover {
        transform: none !important;
    }

    .profile-avatar:hover {
        transform: none !important;
    }

    .btn-primary:hover,
    .btn-outline:hover,
    .btn-ghost:hover {
        transform: none !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }

    .profile-card {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .profile-header {
        animation: none !important;
    }
}

/* Focus states */
.btn-primary:focus-visible,
.btn-outline:focus-visible,
.btn-ghost:focus-visible,
.form-group input:focus-visible,
.form-group textarea:focus-visible,
#logoutBtn:focus-visible {
    outline: 2px solid var(--sermon-purple);
    outline-offset: 3px;
  }

/* =========================================================
   BOTTOM NAV (self-contained — profile.html does not load
   the global style.css, so the nav is styled here to match)
   ========================================================= */
body {
    padding-bottom: 92px;
}

#bottom-nav {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(239, 234, 228, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(4px, 2vw, 24px);
    padding: 6px 12px env(safe-area-inset-bottom, 10px);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
}

#bottom-nav .tab-btn {
    text-decoration: none;
    font-family: inherit;
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 6px 14px;
    border-radius: 30px;
    cursor: pointer;
    color: #A09898;
    transition: all 0.25s var(--ease);
    min-width: 52px;
}

#bottom-nav .tab-btn i {
    font-size: clamp(18px, 1.8vw, 24px);
}

#bottom-nav .tab-btn span {
    font-size: clamp(10px, 0.7vw, 13px);
    font-weight: 400;
}

#bottom-nav .tab-btn.active {
    background: linear-gradient(135deg, var(--sermon-purple), var(--sermon-purple-deep));
    color: #FFFFFF;
    box-shadow: 0 4px 16px rgba(107, 63, 160, 0.25);
    transform: translateY(-1px);
}

#bottom-nav .tab-btn:not(.active):hover {
    color: var(--sermon-purple);
    background: rgba(107, 63, 160, 0.06);
}

@media (max-width: 480px) {
    #bottom-nav {
        gap: 2px;
        padding: 4px 4px env(safe-area-inset-bottom, 8px);
    }
    #bottom-nav .tab-btn {
        padding: 4px 10px;
        min-width: 44px;
    }
    #bottom-nav .tab-btn i {
        font-size: clamp(16px, 1.6vw, 20px);
    }
    #bottom-nav .tab-btn span {
        font-size: 9px;
    }
}
