/* ==========================================================================
   OAUTH WIZARD & COMPONENT STYLING
   Styles for App Identity, Account Card, Permissions, and Resource Selection
   ========================================================================== */

/* Progress Indicator */
.oauth-progress-bar {
    height: 3px;
    background: var(--oauth-border);
    position: relative;
    overflow: hidden;
}

.oauth-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--oauth-primary) 0%, var(--oauth-secondary) 100%);
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* App Identity / Connection Diagram */
.oauth-identity-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 10px 0;
}

.oauth-identity-badge {
    width: 54px;
    height: 54px;
    border-radius: var(--oauth-radius-lg);
    background: var(--oauth-bg-card);
    border: 1px solid var(--oauth-border);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--oauth-shadow-sm);
    position: relative;
}

.oauth-identity-badge svg {
    width: 28px;
    height: 28px;
}

.oauth-identity-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--oauth-text-tertiary);
    animation: pulseConnector 2s infinite ease-in-out;
}

@keyframes pulseConnector {
    0%, 100% { opacity: 0.5; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* Typography Hierarchy */
.oauth-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--oauth-text-primary);
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.oauth-subtitle {
    font-size: 13px;
    color: var(--oauth-text-secondary);
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Account Card */
.oauth-account-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--oauth-bg-card);
    border: 1px solid var(--oauth-border);
    border-radius: var(--oauth-radius-md);
    margin-bottom: 20px;
    transition: border-color 0.2s;
    cursor: pointer;
}

.oauth-account-card:hover {
    border-color: var(--oauth-border-hover);
    background: var(--oauth-bg-hover);
}

.oauth-account-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.oauth-account-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--oauth-primary) 0%, var(--oauth-secondary) 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.15);
}

.oauth-account-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--oauth-text-primary);
}

.oauth-account-email {
    font-size: 12px;
    color: var(--oauth-text-secondary);
}

.oauth-account-switch {
    font-size: 12px;
    color: var(--oauth-primary);
    font-weight: 600;
}

/* Permissions List */
.oauth-permissions-box {
    background: var(--oauth-bg-card);
    border: 1px solid var(--oauth-border);
    border-radius: var(--oauth-radius-md);
    padding: 14px 16px;
    margin-bottom: 20px;
}

.oauth-permissions-header {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--oauth-text-tertiary);
    font-weight: 700;
    margin-bottom: 12px;
}

.oauth-permissions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    list-style: none;
}

.oauth-permission-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
    line-height: 1.4;
}

.oauth-permission-icon {
    width: 18px;
    height: 18px;
    color: var(--oauth-primary);
    flex-shrink: 0;
    margin-top: 1px;
}

.oauth-permission-content strong {
    display: block;
    color: var(--oauth-text-primary);
    font-weight: 600;
}

.oauth-permission-content span {
    color: var(--oauth-text-secondary);
    font-size: 12px;
}

/* ==========================================================================
   RESOURCE SELECTION (Facebook Pages style)
   ========================================================================== */

.oauth-resource-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.oauth-resource-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 4px 10px;
    border-bottom: 1px solid var(--oauth-border);
}

.oauth-select-all-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--oauth-text-primary);
}

.oauth-resource-count-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--oauth-text-secondary);
    background: var(--oauth-bg-input);
    padding: 2px 8px;
    border-radius: var(--oauth-radius-full);
    border: 1px solid var(--oauth-border);
}

.oauth-resource-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

/* Custom Scrollbar */
.oauth-resource-list::-webkit-scrollbar {
    width: 6px;
}

.oauth-resource-list::-webkit-scrollbar-track {
    background: transparent;
}

.oauth-resource-list::-webkit-scrollbar-thumb {
    background: var(--oauth-border-hover);
    border-radius: 4px;
}

/* Individual Resource Card */
.oauth-resource-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--oauth-bg-card);
    border: 1px solid var(--oauth-border);
    border-radius: var(--oauth-radius-md);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.oauth-resource-card:hover {
    background: var(--oauth-bg-hover);
    border-color: var(--oauth-border-hover);
    transform: translateY(-1px);
}

.oauth-resource-card.selected {
    background: var(--oauth-bg-active);
    border-color: rgba(var(--oauth-primary-rgb), 0.4);
}

.oauth-resource-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.oauth-resource-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--oauth-radius-sm);
    background: var(--oauth-bg-input);
    border: 1px solid var(--oauth-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.oauth-resource-details {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.oauth-resource-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--oauth-text-primary);
}

.oauth-resource-desc {
    font-size: 11px;
    color: var(--oauth-text-secondary);
}

/* Checkbox Component */
.oauth-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1.5px solid var(--oauth-text-tertiary);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease-in-out;
    flex-shrink: 0;
}

.oauth-resource-card.selected .oauth-checkbox,
.oauth-checkbox.checked {
    background: var(--oauth-primary);
    border-color: var(--oauth-primary);
}

.oauth-checkbox svg {
    opacity: 0;
    transform: scale(0.6);
    transition: all 0.15s ease-in-out;
    color: var(--oauth-text-inverse);
}

.oauth-resource-card.selected .oauth-checkbox svg,
.oauth-checkbox.checked svg {
    opacity: 1;
    transform: scale(1);
}

/* Zero Resources Warning / Info */
.oauth-notice-box {
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.25);
    border-radius: var(--oauth-radius-md);
    padding: 10px 14px;
    font-size: 12px;
    color: var(--oauth-text-secondary);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 8px;
}

/* Success Milestone State */
.oauth-success-badge {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(var(--oauth-primary-rgb), 0.12);
    border: 2px solid var(--oauth-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--oauth-primary);
    margin: 16px auto 20px;
    box-shadow: var(--oauth-glow-primary);
    animation: successPulse 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes successPulse {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
