/* ================================================================
   IDP Component Styles
   Matches Portal design system (Inter, CSS variables, cards, pills)
   ================================================================ */

/* ── Back Link ── */
.idp-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
    margin-bottom: 0.5rem;
}

.idp-back-link:hover {
    color: var(--accent);
}

/* ── Manage Layout Shell ── */
.idp-manage-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.idp-manage-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 1.5rem 0;
}

.idp-manage-content {
    flex: 1;
    min-width: 0;
    padding: 2.5rem 3rem;
    overflow-y: auto;
    background: var(--bg);
}

/* ── Sidebar Navigation ── */
.idp-nav {
    list-style: none;
    padding: 0 0.75rem;
    margin: 0;
}

.idp-nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1.25rem 0.75rem 0.5rem;
    display: block;
    list-style: none;
}

.idp-nav-section-title:first-child {
    padding-top: 0;
}

.idp-nav-item {
    list-style: none;
}

.idp-nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    margin: 2px 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-body);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.15s ease;
}

.idp-nav-link:hover {
    background: var(--accent-soft);
    color: var(--text);
    text-decoration: none;
}

.idp-nav-link.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.idp-nav-link.active:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.idp-nav-link i {
    width: 18px;
    text-align: center;
    font-size: 13px;
    opacity: 0.7;
}

.idp-nav-link.active i {
    opacity: 1;
}

/* ── Manage Cards ── */
.idp-manage-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.idp-manage-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

/* ── Page Headers ── */
.idp-page-header {
    margin-bottom: 2rem;
}

.idp-page-header h3 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.idp-page-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

/* ── Form Groups ── */
.idp-form-group {
    margin-bottom: 1.5rem;
}

.idp-form-label,
.idp-form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.idp-form-input {
    width: 100%;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--f-sans);
    font-size: 0.9375rem;
    height: 48px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    outline: none;
}

.idp-form-input::placeholder {
    color: var(--text-faint);
}

.idp-form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg);
    color: var(--text);
}

.idp-form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Autofill override for idp-form-input */
.idp-form-input:-webkit-autofill,
.idp-form-input:-webkit-autofill:hover,
.idp-form-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-alt) inset !important;
    -webkit-text-fill-color: var(--text) !important;
    border: 1px solid var(--border) !important;
    caret-color: var(--text) !important;
}

.idp-form-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--bg) inset !important;
    border-color: var(--accent) !important;
}

.idp-field-error {
    color: #EF4444;
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    display: block;
}

/* ── Alerts ── */
.idp-alert {
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    border: 1px solid;
    margin-bottom: 1.5rem;
}

.idp-alert strong {
    display: block;
    margin-bottom: 0.25rem;
}

.idp-alert-success {
    background: rgba(22, 163, 74, 0.08);
    border-color: var(--success);
    color: var(--success);
}

.idp-alert-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: #EF4444;
    color: #EF4444;
}

.idp-alert-warning {
    background: rgba(217, 119, 6, 0.08);
    border-color: var(--warning);
    color: var(--warning);
}

.idp-alert a {
    color: inherit;
    text-decoration: underline;
}

/* ── Auth Page Shared Classes ── */
.idp-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 1.5rem 0;
    color: var(--text-faint);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.idp-divider::before,
.idp-divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--border);
}

.idp-divider::before {
    margin-right: 1rem;
}

.idp-divider::after {
    margin-left: 1rem;
}

.idp-external-btn {
    background: transparent !important;
    color: var(--text) !important;
    border: 1.5px solid var(--border) !important;
    border-radius: 50px !important;
    font-family: var(--f-sans) !important;
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s cubic-bezier(.22,1,.36,1);
    margin-bottom: 0.5rem;
}

.idp-external-btn:hover {
    background: var(--accent-soft) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.idp-footer-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.idp-footer-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

.idp-footer-card p {
    margin: 0;
    font-size: 0.875rem;
}

.idp-name-row {
    display: flex;
    gap: 1rem;
}

.idp-name-row > div {
    flex: 1;
}

/* ── Photo Upload ── */
.idp-photo-upload {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-alt);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.idp-photo-upload:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.idp-photo-preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.idp-photo-preview i {
    font-size: 24px;
    color: var(--text-faint);
}

.idp-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.idp-photo-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.idp-photo-text strong {
    display: block;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

/* ── Verified Badge ── */
.idp-verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--success);
    background: rgba(22, 163, 74, 0.08);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    white-space: nowrap;
}

/* ── List Items ── */
.idp-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.idp-list-item:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

/* ── Recovery Codes Grid ── */
.idp-recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 1.5rem;
    background: var(--bg-alt);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.idp-recovery-codes code {
    font-family: var(--f-mono);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    text-align: center;
    color: var(--text);
}

/* ── QR Code Container ── */
.idp-qr-container {
    display: flex;
    justify-content: center;
    padding: 1.5rem;
    background: #FFFFFF;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: 1rem 0;
}

/* ── Preview Panel (LanguageRegion) ── */
.idp-preview-panel {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-top: 1rem;
}

.idp-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.idp-preview-item {
    display: flex;
    flex-direction: column;
}

.idp-preview-label {
    font-size: 0.75rem;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0.25rem;
}

.idp-preview-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
}

/* ── Wallet Summary ── */
.idp-wallet-summary {
    background: var(--btn-gradient);
    color: #FFFFFF;
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.idp-wallet-amount {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.idp-wallet-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

/* ── Card Brand Badge ── */
.idp-card-brand {
    min-width: 44px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* ── Empty State ── */
.idp-empty-state {
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    text-align: center;
    color: var(--text-muted);
}

.idp-empty-state .title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

/* ── Button Groups ── */
.idp-button-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* ── Danger Button ── */
.btn-danger {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%) !important;
    color: #FFFFFF !important;
    border: none !important;
    border-radius: 50px !important;
    font-family: var(--f-sans) !important;
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0.75rem 2rem;
    transition: all 0.3s cubic-bezier(.22,1,.36,1);
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25) !important;
    transform: translateY(-1px);
    color: #FFFFFF !important;
}

.btn-danger:active {
    transform: translateY(0);
}

/* ── Select / Dropdown Override ── */
.form-select {
    background-color: var(--bg-alt) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    color: var(--text) !important;
    font-family: var(--f-sans) !important;
    font-size: 0.9375rem;
    height: 48px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-glow) !important;
}

/* ── Modal Theme Overrides ── */
.idp-manage-wrapper .modal-content,
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
}

.idp-manage-wrapper .modal-header,
.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
}

.idp-manage-wrapper .modal-header .modal-title,
.modal-header .modal-title {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text);
}

.idp-manage-wrapper .modal-body,
.modal-body {
    padding: 1.5rem;
}

.idp-manage-wrapper .modal-footer,
.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

.btn-close {
    filter: var(--btn-close-filter, none);
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .idp-manage-wrapper {
        flex-direction: column;
    }

    .idp-manage-sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 1rem 0.5rem;
    }

    .idp-manage-content {
        padding: 1.5rem;
    }

    .idp-wallet-summary {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .idp-preview-grid {
        grid-template-columns: 1fr;
    }

    .idp-name-row {
        flex-direction: column;
        gap: 0;
    }
}
