/* =============================================
   Profile & Settings — Premium Styles
   ============================================= */

/* ── Profile Hero ─────────────────────── */
.profile-hero {
    position: relative;
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
    background: var(--card);
    box-shadow: var(--shadow);
}

.profile-hero-bg {
    height: 140px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #00a67e 100%);
    position: relative;
}

.profile-hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.profile-hero-content {
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
    padding: 0 2rem 1.5rem;
    margin-top: -50px;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}

.profile-avatar-lg {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #34d399 100%);
    border: 4px solid var(--card);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    flex-shrink: 0;
}

.profile-hero-info {
    flex: 1;
    min-width: 200px;
    padding-bottom: 0.5rem;
}

.profile-hero-info h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.15rem;
}

.profile-hero-info p {
    color: var(--text-3);
    font-size: 0.92rem;
    margin-bottom: 0.6rem;
}

.profile-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-role { background: #eef2ff; color: #4f46e5; }
.badge-approved { background: #ecfdf5; color: #059669; }
.badge-pending { background: #fffbeb; color: #d97706; }
.badge-eco { background: #f0fdf4; color: #16a34a; }

.profile-hero-stats {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 0;
}

.profile-stat-item {
    text-align: center;
}

.profile-stat-num {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.profile-stat-lbl {
    display: block;
    font-size: 0.78rem;
    color: var(--text-3);
    margin-top: 0.25rem;
}

/* ── Profile Tabs ─────────────────────── */
.profile-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--card);
    padding: 0.5rem;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
}

.profile-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border: none;
    background: transparent;
    border-radius: var(--r);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-3);
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
}

.profile-tab:hover {
    background: var(--primary-lt);
    color: var(--primary);
}

.profile-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 166, 126, 0.3);
}

.tab-icon { font-size: 1.1rem; }

/* ── Profile Section Card ─────────────── */
.profile-section {
    background: var(--card);
    border-radius: var(--r-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    animation: profileFadeIn 0.35s ease;
}

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

.profile-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.profile-section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.profile-section-header p {
    color: var(--text-3);
    font-size: 0.88rem;
}

.security-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

/* ── Profile Form ─────────────────────── */
.profile-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.profile-form-single {
    grid-template-columns: 1fr;
    max-width: 500px;
}

.profile-field-full {
    grid-column: 1 / -1;
}

.profile-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 0.5rem;
}

.label-icon { font-size: 1rem; }

.profile-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--r);
    font-size: 0.95rem;
    color: var(--text);
    background: #fafbfc;
    transition: all 0.2s ease;
    font-family: inherit;
    direction: rtl;
}

.profile-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 166, 126, 0.12);
}

.profile-input:disabled {
    background: #f1f5f9;
    color: var(--text-3);
    cursor: not-allowed;
}

.profile-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

/* ── Password Field ───────────────────── */
.password-field {
    position: relative;
}

.password-field .profile-input {
    padding-left: 3rem;
}

.password-toggle {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.password-toggle:hover { opacity: 1; }

/* ── Password Strength ────────────────── */
.password-strength {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-3);
}

.strength-bar {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: var(--border);
    position: relative;
    overflow: hidden;
}

.strength-bar::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    height: 100%;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.strength-bar.weak::after { width: 30%; background: #ef4444; }
.strength-bar.medium::after { width: 60%; background: #f59e0b; }
.strength-bar.strong::after { width: 100%; background: #10b981; }

/* ── Field Hints ──────────────────────── */
.field-hint {
    font-size: 0.82rem;
    margin-top: 0.4rem;
    font-weight: 500;
}

.field-hint-error { color: #ef4444; }
.field-hint-success { color: #10b981; }

/* ── Form Actions ─────────────────────── */
.profile-form-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.profile-btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: var(--r);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
}

.profile-btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #34d399 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(0, 166, 126, 0.3);
}

.profile-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 166, 126, 0.4);
}

.profile-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ── Alerts ────────────────────────────── */
.profile-alert {
    padding: 0.85rem 1.25rem;
    border-radius: var(--r);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    animation: profileFadeIn 0.3s ease;
}

.profile-alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.profile-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ── Security Tips ─────────────────────── */
.security-tips {
    margin-top: 2rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #ecfdf5 100%);
    border-radius: var(--r);
    border: 1px solid #e0f2fe;
}

.security-tips h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.security-tips ul {
    list-style: none;
    padding: 0;
}

.security-tips li {
    padding: 0.35rem 0;
    padding-right: 1.2rem;
    position: relative;
    color: var(--text-2);
    font-size: 0.85rem;
    line-height: 1.6;
}

.security-tips li::before {
    content: '•';
    position: absolute;
    right: 0;
    color: var(--primary);
    font-weight: bold;
}

/* ── Loading Spinner ───────────────────── */
.profile-loading {
    text-align: center;
}

.profile-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Responsive ────────────────────────── */
@media (max-width: 768px) {
    .profile-hero-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0 1rem 1.5rem;
    }

    .profile-hero-info { text-align: center; }
    .profile-badges { justify-content: center; }

    .profile-hero-stats {
        justify-content: center;
        width: 100%;
    }

    .profile-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .profile-tab {
        white-space: nowrap;
        font-size: 0.85rem;
        padding: 0.75rem 0.8rem;
    }

    .profile-section { padding: 1.25rem; }
    .profile-form-grid { grid-template-columns: 1fr; }
    .profile-form-single { max-width: 100%; }
}
