/* ══════════════════════════════════════════════════════════
   PROFILE PAGE  ·  assets/css/profile.css
   ══════════════════════════════════════════════════════════ */

/* ── Page wrapper ── */
.iw-profile-page {
    max-width: 820px;
    margin: 0 auto;
    padding-bottom: 64px;
}

/* ── Cover Banner ── */
.iw-profile-cover {
    height: 180px;
    background: linear-gradient(135deg, var(--iw-navy) 0%, #2d4a7a 55%, #1e3560 100%);
    position: relative;
    overflow: hidden;
}

.iw-profile-cover::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 28px 28px;
}

/* ── Profile Card ── */
.iw-profile-card {
    background: #fff;
    border: 1px solid var(--iw-border);
    border-radius: var(--iw-radius);
    box-shadow: 0 4px 20px rgba(27,43,75,0.08);
    margin: -56px 24px 0;
    padding: 24px 28px 28px;
    display: flex;
    gap: 24px;
    align-items: flex-start;
    position: relative;
    z-index: 2;
}

/* ── Avatar ── */
.iw-profile-avatar-col {
    flex-shrink: 0;
}

.iw-profile-avatar-wrap {
    position: relative;
    width: 100px;
    height: 100px;
    margin-top: -50px;
}

.iw-profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 2px 12px rgba(27,43,75,0.18);
    object-fit: cover;
    display: block;
    background: #e5e7eb;
}

.iw-profile-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    color: #9ca3af;
}

.iw-profile-hidden-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

/* ── Profile Info ── */
.iw-profile-info {
    flex: 1;
    min-width: 0;
    padding-top: 8px;
}

.iw-profile-name-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.iw-profile-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--iw-navy);
    margin: 0;
    line-height: 1.2;
}

.iw-profile-edit-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: transparent;
    border: 1.5px solid var(--iw-border);
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--iw-navy);
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s, color 0.18s;
    white-space: nowrap;
    font-family: inherit;
}
.iw-profile-edit-toggle:hover {
    border-color: var(--iw-orange);
    color: var(--iw-orange);
    background: rgba(224,123,57,0.05);
}

.iw-profile-meta {
    font-size: 0.82rem;
    color: #6b7280;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.iw-profile-meta-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #d1d5db;
    display: inline-block;
    flex-shrink: 0;
}

/* ── Stats ── */
.iw-profile-stats {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.iw-profile-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.iw-profile-stat-num {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--iw-navy);
    line-height: 1;
}

.iw-profile-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9ca3af;
    font-weight: 600;
}

.iw-profile-stat-sep {
    width: 1px;
    height: 32px;
    background: var(--iw-border);
}

/* ── Notice ── */
.iw-profile-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 20px 24px 0;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 600;
}

.iw-profile-notice--success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* ── Body ── */
.iw-profile-body {
    margin: 24px 24px 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ── Section Titles ── */
.iw-profile-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--iw-navy);
    margin: 0 0 16px;
}

.iw-profile-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.iw-profile-section-header .iw-profile-section-title {
    margin-bottom: 0;
}

.iw-profile-section-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    padding: 0 7px;
    background: var(--iw-navy);
    color: #fff;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
}

/* ── About / Bio ── */
.iw-profile-about {
    background: #fff;
    border: 1px solid var(--iw-border);
    border-radius: var(--iw-radius);
    padding: 24px;
}

.iw-profile-bio-text {
    font-size: 0.94rem;
    color: #374151;
    line-height: 1.7;
    margin: 0;
}

.iw-profile-bio-empty {
    font-size: 0.88rem;
    color: #9ca3af;
    font-style: italic;
    margin: 0;
}

/* ── Edit Form ── */
.iw-profile-edit-wrap {
    background: #fff;
    border: 1px solid var(--iw-border);
    border-radius: var(--iw-radius);
    padding: 24px;
}

.iw-profile-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.iw-profile-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}
.iw-profile-field:last-of-type,
.iw-profile-form-row .iw-profile-field {
    margin-bottom: 0;
}

.iw-profile-field label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--iw-navy);
    cursor: pointer;
}

.iw-profile-field input[type="text"],
.iw-profile-field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--iw-border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: #1f2937;
    font-family: inherit;
    background: #fafafa;
    transition: border-color 0.18s, background 0.18s;
    box-sizing: border-box;
    resize: vertical;
}
.iw-profile-field input[type="text"]:focus,
.iw-profile-field textarea:focus {
    outline: none;
    border-color: var(--iw-navy);
    background: #fff;
}
.iw-profile-field input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: #f3f4f6;
}

.iw-profile-field-note {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* ── Privacy Toggle Switch ── */
.iw-profile-field--privacy {
    margin-bottom: 24px;
}

.iw-profile-toggle-label {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    cursor: pointer;
    user-select: none;
}
.iw-profile-toggle-label > input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.iw-profile-toggle-track {
    flex-shrink: 0;
    width: 44px;
    height: 24px;
    background: #d1d5db;
    border-radius: 12px;
    position: relative;
    transition: background 0.2s;
    margin-top: 2px;
}
.iw-profile-toggle-label > input:checked + .iw-profile-toggle-track {
    background: var(--iw-navy);
}
.iw-profile-toggle-label > input:focus-visible + .iw-profile-toggle-track {
    outline: 2px solid var(--iw-navy);
    outline-offset: 2px;
}

.iw-profile-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.iw-profile-toggle-label > input:checked + .iw-profile-toggle-track .iw-profile-toggle-thumb {
    transform: translateX(20px);
}

.iw-profile-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.88rem;
}
.iw-profile-toggle-text strong {
    font-size: 0.9rem;
    color: var(--iw-navy);
    font-weight: 600;
}
.iw-profile-toggle-text > span {
    color: #6b7280;
    font-size: 0.8rem;
}

/* ── Form Actions ── */
.iw-profile-form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.iw-profile-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 22px;
    background: var(--iw-navy);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.18s;
}
.iw-profile-save-btn:hover {
    background: #253d6b;
}

.iw-profile-cancel-btn {
    padding: 10px 18px;
    background: transparent;
    border: 1.5px solid var(--iw-border);
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    color: #6b7280;
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s;
}
.iw-profile-cancel-btn:hover {
    border-color: #9ca3af;
    color: #374151;
}

/* ── Generic Sections (articles, submissions) ── */
.iw-profile-section {
    background: #fff;
    border: 1px solid var(--iw-border);
    border-radius: var(--iw-radius);
    padding: 24px;
}

/* ── Article Carousel ── */
.iw-carousel-outer {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.iw-carousel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    flex: 1;
}
.iw-carousel::-webkit-scrollbar {
    display: none;
}

.iw-carousel-item {
    flex: 0 0 260px;
    scroll-snap-align: start;
}

.iw-carousel-arrow {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid var(--iw-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--iw-navy);
    transition: border-color 0.18s, box-shadow 0.18s, opacity 0.18s;
}
.iw-carousel-arrow:hover:not(:disabled) {
    border-color: var(--iw-navy);
    box-shadow: 0 2px 8px rgba(27,43,75,0.12);
}
.iw-carousel-arrow--dim,
.iw-carousel-arrow:disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

/* ── Submission History ── */
.iw-submissions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.iw-sub-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: #f9fafb;
    border: 1px solid var(--iw-border);
    border-radius: 8px;
    transition: border-color 0.18s;
}
.iw-sub-item:hover {
    border-color: #d1d5db;
}

.iw-sub-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: #fff;
    border: 1px solid var(--iw-border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.iw-sub-body {
    flex: 1;
    min-width: 0;
}

.iw-sub-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--iw-navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.iw-sub-meta {
    font-size: 0.76rem;
    color: #9ca3af;
    margin-top: 2px;
}

.iw-sub-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.iw-sub-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.iw-sub-status--pending  { background: #fef9c3; color: #b45309; }
.iw-sub-status--review   { background: #dbeafe; color: #1d4ed8; }
.iw-sub-status--approved { background: #dcfce7; color: #16a34a; }
.iw-sub-status--rejected { background: #fee2e2; color: #dc2626; }

.iw-sub-file-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: #f3f4f6;
    color: #6b7280;
    transition: background 0.18s, color 0.18s;
    text-decoration: none;
}
.iw-sub-file-btn:hover {
    background: var(--iw-navy);
    color: #fff;
}

/* ── Empty State ── */
.iw-profile-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 20px;
    color: #9ca3af;
    text-align: center;
}
.iw-profile-empty p {
    font-size: 0.9rem;
    margin: 0;
}
.iw-profile-empty-link {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--iw-orange);
    text-decoration: none;
}
.iw-profile-empty-link:hover {
    text-decoration: underline;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */

/* Tablet ≤ 680px */
@media (max-width: 680px) {
    .iw-profile-cover {
        height: 140px;
    }
    .iw-profile-card {
        margin: -44px 16px 0;
        padding: 16px 18px 20px;
        gap: 16px;
    }
    .iw-profile-avatar-wrap {
        width: 84px;
        height: 84px;
        margin-top: -42px;
    }
    .iw-profile-avatar {
        width: 84px;
        height: 84px;
    }
    .iw-profile-name {
        font-size: 1.2rem;
    }
    .iw-profile-form-row {
        grid-template-columns: 1fr;
    }
    .iw-profile-body {
        margin: 16px 16px 0;
    }
    .iw-profile-notice {
        margin: 16px 16px 0;
    }
    .iw-profile-stats {
        gap: 14px;
    }
    .iw-carousel-item {
        flex: 0 0 230px;
    }
}

/* Mobile ≤ 460px */
@media (max-width: 460px) {
    .iw-profile-cover {
        height: 110px;
    }
    .iw-profile-card {
        flex-direction: column;
        align-items: flex-start;
        margin: -30px 12px 0;
        padding: 12px 16px 18px;
    }
    .iw-profile-avatar-col {
        align-self: center;
        width: 100%;
        display: flex;
        justify-content: center;
    }
    .iw-profile-avatar-wrap {
        margin-top: -50px;
    }
    .iw-profile-info {
        padding-top: 4px;
        width: 100%;
    }
    .iw-profile-name-row {
        justify-content: center;
    }
    .iw-profile-name {
        font-size: 1.1rem;
    }
    .iw-profile-meta {
        justify-content: center;
    }
    .iw-profile-stats {
        justify-content: center;
    }
    .iw-profile-body {
        margin: 12px 12px 0;
    }
    .iw-profile-notice {
        margin: 12px 12px 0;
    }
    .iw-carousel-item {
        flex: 0 0 200px;
    }
    .iw-sub-item {
        flex-wrap: wrap;
    }
    .iw-sub-right {
        width: 100%;
        justify-content: space-between;
    }
}
