/**
 * Supplier Profile Tab Styles
 * /my-account/{company-slug}/profile/
 *
 * Also contains User Profile styles (.palomarr-profile-section)
 */

/* =============================================================================
   User Profile Section
   ============================================================================= */

.palomarr-profile-section {
    flex-grow: 4;
    padding: 3rem 4rem 4rem;
    max-width: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.palomarr-profile-section.visible {
    opacity: 1;
}

.palomarr-profile-section>div {
    max-width: 40rem;
    margin: 0 auto;
}

/* =============================================================================
   User Profile: View Mode
   ============================================================================= */

.profile-view-mode {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
}

.profile-avatar-container {
    flex-shrink: 0;
}

.profile-avatar {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
}

.profile-avatar img,
.profile-avatar .profile-avatar-img {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    border-radius: 50%;
}

.profile-avatar-edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 50%;
}

.profile-avatar:hover .profile-avatar-edit-overlay {
    opacity: 1;
}

.profile-avatar-edit-overlay svg {
    width: 32px;
    height: 32px;
}

.profile-info {
    flex: 1;
}

.profile-info .profile-email {
    color: #8b9b97 !important;
    margin: 0 0 1.5rem 0;
}

.profile-edit-btn {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
}

/* =============================================================================
   User Profile: Edit Mode
   ============================================================================= */

.profile-edit-mode {
    animation: fadeIn 0.2s ease;
}

.profile-edit-avatar-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.profile-edit-avatar {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
}

.profile-edit-avatar img {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    border-radius: 50%;
}

.profile-edit-avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 50%;
}

.profile-edit-avatar:hover .profile-edit-avatar-overlay {
    opacity: 1;
}

.profile-edit-avatar-overlay svg {
    width: 24px;
    height: 24px;
}

.profile-edit-avatar-overlay span {
    color: #fff;
    font-size: 0.75rem;
}

.profile-edit-fields {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.profile-field input {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.profile-field input::placeholder {
    color: #999;
}

.profile-field input:focus {
    outline: none;
    border-color: var(--color-accent, #789965);
    box-shadow: 0 0 0 3px rgba(120, 153, 101, 0.15);
}

.profile-edit-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.profile-back-btn,
.profile-save-btn {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-back-btn {
    background: #f5f5f5;
    border: 1px solid #ddd;
    color: #555;
}

.profile-back-btn:hover {
    background: #eee;
}

.profile-save-btn {
    background: var(--color-accent, #789965);
    border: none;
    color: #fff;
}

.profile-save-btn:hover {
    background: #6a8a57;
}

.profile-save-btn:disabled,
.profile-password-save-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* =============================================================================
   User Profile: Actions
   ============================================================================= */

.profile-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* =============================================================================
   User Profile: Password Mode
   ============================================================================= */

.profile-password-mode {
    animation: fadeIn 0.2s ease;
}

.profile-password-title {
    margin: 0 0 2rem 0 !important;
    font-size: 1.5rem !important;
}

.profile-password-fields {
    margin-bottom: 2rem;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

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

.password-toggle img {
    width: 1.3rem !important;
    height: 1.3rem !important;
    margin: 0 0.2rem 0 0 !important;
}

.password-requirements {
    display: flex;
    align-items: center;
    margin: 0.3rem 0 0 1.2rem;
    gap: 1rem;
    padding: 0;
}

.password-requirements .requirement {
    font-size: 0.8rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0;
    opacity: 0.85;
    transition: all 0.2s ease;
}

.password-requirements .requirement .icon {
    font-size: 0.75rem;
    width: 1rem;
    text-align: center;
}

.password-requirements .requirement.met {
    color: var(--color-accent) !important;
    opacity: 1;
}

.password-requirements .requirement.met .icon {
    color: var(--color-accent) !important;
}

/* =============================================================================
   User Profile: Mobile
   ============================================================================= */

@media only screen and (max-width: 640px) {
    .palomarr-profile-section {
        padding: 1.5rem;
    }

    .profile-view-mode {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }

    .profile-avatar,
    .profile-edit-avatar {
        margin: 0 auto;
        width: 100px;
        height: 100px;
    }

    .profile-edit-actions {
        flex-direction: column-reverse;
    }

    .profile-back-btn,
    .profile-save-btn,
    .profile-password-back-btn,
    .profile-password-save-btn {
        width: 100%;
    }

    .profile-actions {
        flex-direction: column;
        width: 100%;
    }

    .profile-actions button {
        width: 100%;
    }

    .password-requirements {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .palomarr-profile-section>div>div {
        width: 100%;
        margin: 0 auto;
    }
}

/* =============================================================================
   User Profile: Connected Accounts
   ============================================================================= */

.profile-connected-accounts {
    margin-top: 5rem !important;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.connected-accounts-title {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 1.2rem;
}

.connected-account-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.connected-account-only {
    font-size: 0.85rem;
    color: var(--color-green-faded);
}

.connected-account-row.connected .connected-account-icon {
    background: var(--color-white);
}

.connected-account-row .connected-account-data {
    font-size: 0.85rem;
}

.connected-account-row.connected .connected-account-data {
    color: var(--text-white) !important;
}

.connected-account-row:last-child {
    border-bottom: none;
}

.connected-account-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-p-med);
    background: color-mix(in srgb, var(--color-white) 8%, transparent);
}

.connected-account-info {
    flex: 1;
    color: #fff;
    line-height: 1.4;
}

.connected-account-unlink,
.connected-account-connect {
    flex-shrink: 0;
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
}

/* =============================================================================
   Section Layout
   ============================================================================= */

.profile-section {
    margin-bottom: 2.5rem;
}

.profile-row {
    display: flex;
    gap: 5rem;
    margin-bottom: 5rem;
}

.profile-row > .profile-section {
    margin-bottom: 0;
}

.profile-col-half {
    flex: 1;
    min-width: 0;
}

@media (max-width: 640px) {
    .profile-row {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .profile-row > .profile-section {
        margin-bottom: 2.5rem;
    }
}

/* =============================================================================
   Logo
   ============================================================================= */

.profile-logo-wrapper {
    position: relative;
    width: 6.25rem;
    height: 6.25rem;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.profile-logo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: #fff;
}

.profile-logo-wrapper:hover .profile-logo-overlay {
    opacity: 1;
}

.profile-logo-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* =============================================================================
   Form Fields
   ============================================================================= */

.profile-label {
    display: block;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.profile-help {
    font-size: 0.9rem;
    margin: 0 0 0.75rem 0;
    color: var(--color-gray-medium);
}

.profile-input {
    width: 100%;
    max-width: 480px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.profile-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(47, 147, 118, 0.1);
}

body.dark-theme .profile-textarea {
    width: 100%;
    max-width: 480px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border-radius: var(--border-radius-p-2);
    resize: vertical;
    height: 10rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    max-height: 10rem;
    overflow-y: scroll;
}

.profile-field-error {
    display: none;
    font-size: 0.8rem;
    color: var(--color-accent);
    margin-top: 0.5rem;
}

.profile-field-error.active {
    display: block;
}

.profile-char-count {
    text-align: right;
    font-size: 0.8rem;
    color: var(--color-gray-medium);
    margin-top: 0.25rem;
    max-width: 480px;
}

/* =============================================================================
   Redirect Link
   ============================================================================= */

.profile-redirect-link {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.profile-redirect-link a {
    color: var(--color-primary);
    text-decoration: none;
}

.profile-redirect-link a:hover {
    text-decoration: underline;
}

/* =============================================================================
   Screenshots Grid
   ============================================================================= */

.profile-screenshots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11.25rem, 1fr));
    gap: 1rem;
}

/* =============================================================================
   Screenshot Card
   ============================================================================= */

.screenshot-card {
    position: relative;
    border-radius: var(--border-radius-p);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    cursor: grab;
    transition: opacity 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.screenshot-position {
    display: none;
}

.screenshot-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.screenshot-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.screenshot-drag-handle {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.25rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0.25rem;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s ease;
    line-height: 0;
}

.screenshot-delete-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.75rem;
    height: 1.75rem;
    background: url(/wp-content/uploads/2024/08/icon-x-w.svg) color-mix(in srgb, var(--color-black) 50%, transparent) no-repeat center;
    background-size: 8px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.screenshot-delete-btn:hover {
    opacity: 1 !important;
    background-color: color-mix(in srgb, var(--color-black) 80%, transparent);
}

.screenshot-position-badge {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    padding: 0.125rem 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0.625rem;
    color: #fff;
    font-size: 0.75rem;
}

.screenshot-reorder-arrows {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    display: none;
    gap: 0.25rem;
}

.screenshot-arrow-up,
.screenshot-arrow-down {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 0.25rem;
    color: #fff;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.screenshot-arrow-up:disabled,
.screenshot-arrow-down:disabled {
    opacity: 0.3;
}

.screenshot-card:hover .screenshot-drag-handle,
.screenshot-card:hover .screenshot-delete-btn {
    opacity: 1;
}

/* =============================================================================
   Screenshot Drag States
   ============================================================================= */

.screenshot-card.dragging {
    opacity: 0.5;
    border-style: dashed;
}

.screenshot-card.drag-over {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(47, 147, 118, 0.2);
}

/* =============================================================================
   Add Screenshot Card
   ============================================================================= */

.screenshot-add-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 9;
    background-color: rgba(126, 179, 164, .2) !important;
    border-radius: var(--border-radius-p);
    background: transparent;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.screenshot-add-card:hover {
    background-color: rgba(126, 179, 164, .3) !important;
}

.screenshot-add-icon {
    margin-bottom: 0.5rem;
    background: #ffffff2e;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screenshot-add-text {
    font-size: 0.875rem;
    color: var(--color-gray-medium);
}

@media (max-width: 640px) {
    .screenshot-add-text {
        display: none;
    }
}


/* =============================================================================
   Accessibility
   ============================================================================= */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =============================================================================
   Phase 2: Category Picker
   ============================================================================= */

.category-picker {
    position: relative;
}

.category-picker-star {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0 0.125rem;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.category-picker-star-icon {
    width: 0.75rem;
    height: 0.75rem;
    display: block;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.category-picker-star:hover .category-picker-star-icon {
    opacity: 1;
}

.category-picker-star.is-main .category-picker-star-icon {
    opacity: 1;
}


/* =============================================================================
   Phase 2: Pill Suggestions Dropdown
   ============================================================================= */

#integrations-pill-container,
#languages-pill-container {
    position: relative;
}

.pill-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    border-radius: var(--border-radius-p);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--color-black) 10%, transparent);
    margin-top: 0.25rem;
    max-height: 12.5rem;
    overflow-y: auto;
    background: color-mix(in srgb, var(--color-x-black) 80%, transparent);
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
}

.pill-suggestion-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.1s;
}

.pill-suggestion-item:hover {
    background-color: color-mix(in srgb, var(--color-white) 5%, transparent);
}

/* =============================================================================
   Phase 2: Featured Video Preview
   ============================================================================= */

.profile-video-preview {
    margin-top: 0.75rem;
    border-radius: 0.5rem;
    overflow: hidden;
    max-width: 35rem;
}

.profile-video-preview iframe {
    display: block;
    border-radius: 0.5rem;
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media screen and (max-width: 640px) {
    .profile-screenshots-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .screenshot-reorder-arrows {
        display: flex;
    }
}

@media screen and (max-width: 640px) {
    .profile-input,
    .profile-textarea {
        max-width: 100%;
    }

    .profile-char-count {
        max-width: 100%;
    }

    .profile-header {
        gap: 1rem;
    }

    .profile-logo-wrapper {
        width: 5rem;
        height: 5rem;
    }

    .category-picker-dropdown {
        width: 100%;
        max-width: 100%;
    }

    .profile-video-preview {
        max-width: 100%;
    }
}
