/* =============================================
   PROFILE PAGE - Responsive Design
   ============================================= */

/* Page Wrapper */
.profile-page {
    min-height: calc(100vh - 80px);
    padding: 32px 16px 64px;
}

.profile-container {
    max-width: 1100px;
    margin: 0 auto;
}

/* Alert Banner */
.profile-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 24px;
    animation: slideDown 0.3s ease;
}

.profile-alert--success {
    background: rgba(12, 149, 30, 0.08);
    color: #0C951E;
    border: 1px solid rgba(12, 149, 30, 0.2);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Grid Layout ---- */
.profile-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 28px;
    align-items: start;
}

/* =============================================
   LEFT SIDEBAR
   ============================================= */
.profile-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 100px;
}

/* Identity Card */
.profile-identity {
    background: white;
    border-radius: 20px;
    padding: 32px 24px 28px;
    text-align: center;
    border: 1px solid var(--color-gray-200);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.profile-avatar {
    width: 100px;
    height: 100px;
    margin: 0 auto 16px;
    position: relative;
    display: inline-block;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--color-primary);
    object-fit: cover;
}

.profile-avatar__badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 30px;
    height: 30px;
    background: #FFD700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    color: #0a7a1e;
}

.profile-name {
    font-size: 22px;
    font-weight: 800;
    color: var(--color-gray-800);
    margin-bottom: 4px;
    line-height: 1.3;
}

.profile-email {
    font-size: 14px;
    color: var(--color-gray-500);
    margin-bottom: 4px;
    word-break: break-all;
}

.profile-phone {
    font-size: 13px;
    color: var(--color-gray-400);
    margin-bottom: 12px;
}

.profile-level {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-primary);
    padding: 8px 18px;
    border-radius: 20px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
    box-shadow: 0 2px 10px rgba(12, 149, 30, 0.2);
}

.profile-level__discount {
    opacity: 0.9;
}

/* Balance Card */
.profile-balance {
    background: linear-gradient(135deg, #0C951E 0%, #065f46 100%);
    border-radius: 16px;
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.profile-balance__label {
    display: block;
    font-size: 12px;
    opacity: 0.8;
    font-weight: 500;
    margin-bottom: 2px;
}

.profile-balance__amount {
    display: block;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.profile-balance__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.profile-balance__btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Stats */
.profile-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-stat {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: white;
    border-radius: 14px;
    border: 1px solid var(--color-gray-200);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.03);
    transition: border-color 0.2s;
}

.profile-stat:hover {
    border-color: var(--color-primary);
}

.profile-stat__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-stat__icon--green {
    background: rgba(12, 149, 30, 0.1);
    color: #0C951E;
}

.profile-stat__icon--blue {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.profile-stat__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.profile-stat__value {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-stat__label {
    font-size: 12px;
    color: var(--color-gray-500);
    font-weight: 500;
}

/* =============================================
   RIGHT MAIN CONTENT
   ============================================= */
.profile-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Section */
.profile-section {
    /* wrapper only */
}

.profile-section__title {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-gray-800);
    margin-bottom: 14px;
}

/* Quick Actions Grid */
.profile-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.profile-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 22px 12px;
    background: white;
    border-radius: 16px;
    text-decoration: none;
    color: var(--color-gray-700);
    border: 1px solid var(--color-gray-200);
    transition: all 0.2s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.profile-action:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(12, 149, 30, 0.1);
}

.profile-action__icon {
    width: 48px;
    height: 48px;
    background: var(--color-gray-100);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.profile-action:hover .profile-action__icon {
    background: rgba(12, 149, 30, 0.08);
}

.profile-action span {
    font-size: 13px;
    font-weight: 600;
}

/* Menu List */
.profile-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-menu__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: white;
    border-radius: 14px;
    border: 1px solid var(--color-gray-200);
    text-decoration: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
    transition: all 0.2s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.profile-menu__item:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 10px rgba(12, 149, 30, 0.08);
}

.profile-menu__item--danger {
    border-color: rgba(239, 68, 68, 0.15);
}

.profile-menu__item--danger:hover {
    border-color: #ef4444;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.08);
}

.profile-menu__icon {
    width: 44px;
    height: 44px;
    background: rgba(12, 149, 30, 0.08);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    flex-shrink: 0;
    transition: background 0.2s;
}

.profile-menu__item:hover .profile-menu__icon {
    background: rgba(12, 149, 30, 0.12);
}

.profile-menu__icon--danger {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}

.profile-menu__item--danger:hover .profile-menu__icon--danger {
    background: rgba(239, 68, 68, 0.12);
}

.profile-menu__text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.profile-menu__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-gray-800);
}

.profile-menu__title--danger {
    color: #ef4444;
}

.profile-menu__desc {
    font-size: 12px;
    color: var(--color-gray-500);
}

.profile-menu__arrow {
    color: var(--color-gray-400);
    flex-shrink: 0;
    transition: transform 0.2s;
}

.profile-menu__item:hover .profile-menu__arrow {
    transform: translateX(3px);
    color: var(--color-primary);
}

/* Edit Profile Section */
.profile-edit {
    background: white;
    border-radius: 16px;
    padding: 28px 24px;
    border: 1px solid var(--color-gray-200);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.profile-edit__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-gray-200);
}

.profile-edit__close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--color-gray-100);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-gray-500);
    transition: all 0.2s;
}

.profile-edit__close:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}

.profile-edit__form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-edit__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-edit__field label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-gray-700);
}

.profile-edit__field textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--color-gray-200);
    border-radius: 12px;
    font-size: 14px;
    color: var(--color-gray-800);
    background: white;
    font-family: 'Inter', sans-serif;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s;
    outline: none;
}

.profile-edit__field textarea:focus {
    border-color: var(--color-primary);
}

.profile-edit__actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-cancel,
.btn-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-cancel {
    background: var(--color-gray-100);
    color: var(--color-gray-700);
    border: 1px solid var(--color-gray-200);
}

.btn-cancel:hover {
    border-color: var(--color-gray-400);
}

.btn-save {
    background: var(--color-primary);
    color: white;
}

.btn-save:hover {
    background: var(--color-primary-dark);
}

/* =============================================
   RESPONSIVE - Tablet (max 900px)
   ============================================= */
@media (max-width: 900px) {
    .profile-grid {
        grid-template-columns: 280px 1fr;
        gap: 20px;
    }

    .profile-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-identity {
        padding: 24px 18px 22px;
    }

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

/* =============================================
   RESPONSIVE - Mobile (max 768px)
   ============================================= */
@media (max-width: 768px) {
    .profile-page {
        padding: 20px 12px 48px;
    }

    .profile-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .profile-sidebar {
        position: static;
        gap: 16px;
    }

    /* Identity - horizontal compact layout on mobile */
    .profile-identity {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 24px 20px 22px;
        border-radius: 16px;
    }

    .profile-avatar {
        width: 80px;
        height: 80px;
        margin-bottom: 12px;
    }

    .profile-avatar__badge {
        width: 26px;
        height: 26px;
    }

    .profile-avatar__badge svg {
        width: 12px;
        height: 12px;
    }

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

    .profile-email {
        font-size: 13px;
    }

    .profile-level {
        font-size: 12px;
        padding: 6px 14px;
    }

    /* Balance */
    .profile-balance {
        border-radius: 14px;
        padding: 16px 18px;
    }

    .profile-balance__amount {
        font-size: 20px;
    }

    .profile-balance__btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    /* Stats side by side on mobile */
    .profile-stats {
        flex-direction: row;
        gap: 10px;
    }

    .profile-stat {
        flex: 1;
        padding: 14px;
        border-radius: 12px;
        gap: 10px;
    }

    .profile-stat__icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }

    .profile-stat__icon svg {
        width: 18px;
        height: 18px;
    }

    .profile-stat__value {
        font-size: 14px;
    }

    .profile-stat__label {
        font-size: 11px;
    }

    /* Quick Actions 4 cols on mobile too */
    .profile-actions {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .profile-action {
        padding: 16px 8px;
        border-radius: 14px;
        gap: 8px;
    }

    .profile-action__icon {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .profile-action__icon svg {
        width: 20px;
        height: 20px;
    }

    .profile-action span {
        font-size: 11px;
    }

    /* Menu items */
    .profile-menu__item {
        padding: 14px 16px;
        border-radius: 12px;
        gap: 12px;
    }

    .profile-menu__icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .profile-menu__title {
        font-size: 13px;
    }

    .profile-menu__desc {
        font-size: 11px;
    }

    .profile-section__title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    /* Edit section */
    .profile-edit {
        padding: 20px 16px;
        border-radius: 14px;
    }

    .profile-edit__actions {
        flex-direction: column;
    }

    .btn-cancel,
    .btn-save {
        width: 100%;
        padding: 14px 20px;
    }
}

/* =============================================
   RESPONSIVE - Small phones (max 400px)
   ============================================= */
@media (max-width: 400px) {
    .profile-page {
        padding: 16px 8px 40px;
    }

    .profile-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .profile-balance {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        text-align: center;
    }

    .profile-balance__btn {
        justify-content: center;
    }

    .profile-stats {
        flex-direction: column;
    }
}