/**
 * ProCargo Profile Widget Styles
 * Matches Next.js ProfilePage component
 *
 * @package ProCargo
 * @since 2.4.0
 */

/* ========================================
   PAGE WRAPPER
   ======================================== */

.procargo-profile {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: #1a1a2e;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.dark-theme .procargo-profile {
    color: #f3f4f6;
}

/* ========================================
   LOADING OVERLAY
   ======================================== */

.procargo-profile__loading {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.procargo-profile__loading.hidden {
    display: none;
}

body.dark-theme .procargo-profile__loading {
    background: rgba(17, 24, 39, 0.9);
}

.procargo-spinner-large {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #5368B9;
    border-radius: 50%;
    animation: procargo-profile-spin 0.8s linear infinite;
}

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

/* ========================================
   PAGE HEADER
   ======================================== */

.procargo-profile__header {
    margin-bottom: 2rem;
}

.procargo-profile__title {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 0.5rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

body.dark-theme .procargo-profile__title {
    color: #f3f4f6;
}

.procargo-profile__subtitle {
    color: #6b7280;
    margin: 0;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
}

/* ========================================
   ALERTS
   ======================================== */

.procargo-alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.procargo-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

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

body.dark-theme .procargo-alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

body.dark-theme .procargo-alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* ========================================
   TWO-COLUMN LAYOUT
   ======================================== */

.procargo-profile__layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 768px) {
    .procargo-profile__layout {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   SIDEBAR TABS
   ======================================== */

.procargo-profile__tabs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .procargo-profile__tabs {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

.procargo-profile__tab {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    color: #6b7280;
    font-size: 0.95rem;
    font-weight: 500;
    width: 100%;
}

.procargo-profile__tab:hover {
    background: rgba(94, 199, 242, 0.1);
    color: #374151;
}

.procargo-profile__tab.active {
    background: linear-gradient(88deg, #5368B9 -25.12%, #5EC7F2 107.96%);
    color: #fff;
}

body.dark-theme .procargo-profile__tab {
    color: #9ca3af;
}

body.dark-theme .procargo-profile__tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f3f4f6;
}

body.dark-theme .procargo-profile__tab.active {
    color: #fff;
}

/* ========================================
   CONTENT PANELS
   ======================================== */

.procargo-profile__panel {
    display: none;
}

.procargo-profile__panel.active {
    display: block;
}

/* ========================================
   CARDS
   ======================================== */

.procargo-profile__card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

body.dark-theme .procargo-profile__card {
    background: #1f2937;
    border-color: #374151;
}

.procargo-profile__card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.procargo-profile__card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
}

body.dark-theme .procargo-profile__card-title {
    color: #f3f4f6;
}

/* Template uses <h2> directly inside card-header */
.procargo-profile__card-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
    line-height: 1.3;
}

body.dark-theme .procargo-profile__card-header h2 {
    color: #f3f4f6;
}

.procargo-profile__description {
    color: #6b7280;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* card-body spacing */
.procargo-profile__card-body {
    padding-top: 0.25rem;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

.procargo-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;   /* prevent Phone label overlapping the row above */
}

@media (max-width: 640px) {
    .procargo-form-row {
        grid-template-columns: 1fr;
    }
}

.procargo-form-col-6 {
    min-width: 0;
    width: 100%;
}

.procargo-profile .procargo-form-row {
    width: 100%;
    margin-bottom: 2rem !important;     /* gap between row and next standalone field (Phone label) */
}

.procargo-profile .procargo-form-group {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    margin-bottom: 1rem;
    position: relative !important;
    float: none !important;
    overflow: visible !important;
}

/* Label: block-level, pushes input down */
.procargo-profile .procargo-form-group > label {
    display: block !important;
    position: static !important;
    float: none !important;
    flex-shrink: 0 !important;
    margin-bottom: 8px !important;
    width: auto !important;
    height: auto !important;
    z-index: auto !important;
}

/* Input-icon wrapper: block-level, below label */
.procargo-profile .procargo-form-group > .procargo-input-icon {
    display: block !important;
    position: relative !important;
    float: none !important;
    flex-shrink: 0 !important;
    width: 100% !important;
    min-height: 44px !important;
    margin-top: 0 !important;
    clear: both !important;
    box-sizing: border-box !important;
}

/* Password wrapper: block-level, below label */
.procargo-profile .procargo-form-group > .procargo-input-password {
    display: block !important;
    position: relative !important;
    float: none !important;
    flex-shrink: 0 !important;
    width: 100% !important;
    min-height: 44px !important;
    margin-top: 0 !important;
    clear: both !important;
    box-sizing: border-box !important;
}

.procargo-form-group {
    margin-bottom: 1rem;
}

.procargo-form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

body.dark-theme .procargo-form-group label {
    color: #d1d5db;
}

/* ========================================
   INPUT WITH ICON — scoped to .procargo-profile
   Maximum-specificity block to survive ANY theme/global CSS override.
   Theme CSS sets input { display:inline; width:auto } — we must beat that.
   ======================================== */

/* Wrapper: positioning context for icon centering */
.procargo-profile .procargo-input-icon {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    min-height: 44px !important; /* Ensure wrapper has height for icon centering */
}

/* SVG icon: absolute centre-left, vertically centred within input */
.procargo-profile .procargo-input-icon > svg:first-child {
    position: absolute !important;
    left: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 18px !important;
    height: 18px !important;
    color: rgba(83, 104, 185, 0.45) !important;
    pointer-events: none !important;
    z-index: 2 !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
    flex-shrink: 0;
}

/* Input: full width, left-padded to clear icon */
.procargo-profile .procargo-input-icon input[type="text"],
.procargo-profile .procargo-input-icon input[type="tel"],
.procargo-profile .procargo-input-icon input[type="email"],
.procargo-profile .procargo-input-icon input[type="number"],
.procargo-profile .procargo-input-icon input[type="password"],
.procargo-profile .procargo-input-icon input {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0.6875rem 1rem 0.6875rem 2.75rem !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0.5rem !important;
    background: #ffffff !important;
    font-size: 0.95rem !important;
    font-family: inherit !important;
    color: #1a1a2e !important;
    line-height: 1.5 !important;
    height: auto !important;
    min-height: 44px !important;
    margin: 0 !important;
    outline: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease !important;
}

.procargo-profile .procargo-input-icon input:focus {
    border-color: #5EC7F2 !important;
    box-shadow: 0 0 0 3px rgba(94, 199, 242, 0.2) !important;
    outline: none !important;
}

.procargo-profile .procargo-input-icon input:disabled {
    background: #f9fafb !important;
    color: #6b7280 !important;
    cursor: not-allowed !important;
}

body.dark-theme .procargo-profile .procargo-input-icon input {
    background: #374151 !important;
    border-color: #4b5563 !important;
    color: #f3f4f6 !important;
}

/* ========================================
   PASSWORD INPUT — scoped to .procargo-profile
   ======================================== */

/* Password wrapper: positioning context */
.procargo-profile .procargo-input-password {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Left lock icon: absolute, class is on SVG directly */
.procargo-profile .procargo-input-icon-left {
    position: absolute !important;
    left: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 20px !important;
    height: 20px !important;
    color: rgba(83, 104, 185, 0.5) !important;
    pointer-events: none !important;
    z-index: 2 !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
}

/* Password input */
.procargo-profile .procargo-input-password input[type="password"],
.procargo-profile .procargo-input-password input {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0.6875rem 2.75rem !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0.5rem !important;
    background: #ffffff !important;
    font-size: 0.95rem !important;
    font-family: inherit !important;
    color: #1a1a2e !important;
    line-height: 1.5 !important;
    height: auto !important;
    min-height: 44px !important;
    margin: 0 !important;
    outline: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease !important;
}

.procargo-profile .procargo-input-password input:focus {
    border-color: #5EC7F2 !important;
    box-shadow: 0 0 0 3px rgba(94, 199, 242, 0.2) !important;
    outline: none !important;
}

body.dark-theme .procargo-profile .procargo-input-password input {
    background: #374151 !important;
    border-color: #4b5563 !important;
    color: #f3f4f6 !important;
}

.procargo-password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    display: flex;
    align-items: center;
}

.procargo-password-toggle:hover {
    color: #374151;
}

body.dark-theme .procargo-password-toggle {
    color: #9ca3af;
}

/* ========================================
   FORM ACTIONS
   ======================================== */

.procargo-form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* ========================================
   BUTTONS
   ======================================== */

.procargo-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
    line-height: 1;
}

.procargo-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Buttons — scoped to .procargo-profile to beat forms.css override */
.procargo-profile .procargo-btn-outline {
    background: transparent !important;
    border: 1px solid #d1d5db !important;
    color: #374151 !important;
    font-weight: 500 !important;
}

.procargo-profile .procargo-btn-outline:hover {
    background: #f9fafb !important;
    color: #374151 !important;
    text-decoration: none !important;
}

.procargo-profile .procargo-btn-outline svg {
    color: #374151 !important;
}

body.dark-theme .procargo-profile .procargo-btn-outline {
    border-color: #4b5563 !important;
    color: #d1d5db !important;
}

body.dark-theme .procargo-profile .procargo-btn-outline:hover {
    background: #374151 !important;
    color: #d1d5db !important;
}

.procargo-profile .procargo-btn-primary {
    background: linear-gradient(88deg, #5368B9 -25.12%, #5EC7F2 107.96%) !important;
    color: #ffffff !important;
    border: none !important;
}

.procargo-profile .procargo-btn-primary:hover {
    opacity: 0.9 !important;
    color: #ffffff !important;
    text-decoration: none !important;
}

.procargo-profile .procargo-btn-warning {
    background: rgba(245, 158, 11, 0.1) !important;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
    color: #d97706 !important;
}

.procargo-profile .procargo-btn-warning:hover {
    background: rgba(245, 158, 11, 0.2) !important;
    color: #d97706 !important;
}

/* Generic fallback for profile area buttons */
.procargo-btn-outline,
.procargo-btn-primary {
    /* Keep non-scoped variants readable (fallback for non-profile contexts) */
}

.procargo-btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ========================================
   BADGES
   ======================================== */

.procargo-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.procargo-badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.procargo-badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ========================================
   CONTACT FIELDS (verification section)
   ======================================== */

.procargo-profile__contact-field {
    margin-bottom: 1.5rem;
}

.procargo-profile__contact-header {
    display: flex;
    align-items: center;
    /* No space-between: icon+label stay together on left, badge on right */
    gap: 0.625rem;
    margin-bottom: 0.5rem;
    flex-wrap: nowrap;
}

/* Label: grows to push badge right, inherits visual style */
.procargo-profile__contact-label {
    flex: 1;
    font-weight: 500;
    color: #374151;
    font-size: 0.95rem;
}

body.dark-theme .procargo-profile__contact-label {
    color: #d1d5db;
}

/* Icon stays fixed size */
.procargo-profile__contact-icon {
    color: #5EC7F2;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.procargo-profile__contact-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.procargo-profile__contact-value {
    color: #1a1a2e;
    margin: 0.25rem 0 0.5rem 2.25rem;
    font-size: 0.95rem;
}

body.dark-theme .procargo-profile__contact-value {
    color: #f3f4f6;
}

.procargo-profile__info-box {
    padding: 0.75rem 1rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 0.5rem;
    color: #1e40af;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

body.dark-theme .procargo-profile__info-box {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

/* ========================================
   TOGGLE SWITCH
   ======================================== */

.procargo-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    flex-shrink: 0;
}

.procargo-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.procargo-toggle__slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #d1d5db;
    transition: 0.3s ease;
    border-radius: 24px;
}

.procargo-toggle__slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.procargo-toggle input:checked + .procargo-toggle__slider {
    background-color: #5EC7F2;
}

.procargo-toggle input:checked + .procargo-toggle__slider::before {
    transform: translateX(24px);
}

/* ========================================
   2FA ROW
   ======================================== */

.procargo-profile__2fa {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.procargo-profile__2fa-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 0.25rem;
}

.procargo-profile__2fa-info p {
    font-size: 0.85rem;
    color: #6b7280;
    margin: 0;
}

body.dark-theme .procargo-profile__2fa-info h4 {
    color: #f3f4f6;
}

/* ========================================
   PREFERENCES (language, theme)
   ======================================== */

.procargo-profile__preferences-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 640px) {
    .procargo-profile__preferences-grid {
        grid-template-columns: 1fr;
    }
}

.procargo-profile__preference-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.75rem;
}

body.dark-theme .procargo-profile__preference-section h3 {
    color: #d1d5db;
}

.procargo-profile__option-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.procargo-profile__option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: #374151;
}

.procargo-profile__option:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.procargo-profile__option.active {
    background: rgba(94, 199, 242, 0.08);
    border-color: #5EC7F2;
    color: #1a1a2e;
}

body.dark-theme .procargo-profile__option {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

body.dark-theme .procargo-profile__option:hover {
    background: #4b5563;
}

body.dark-theme .procargo-profile__option.active {
    background: rgba(94, 199, 242, 0.1);
    border-color: #5EC7F2;
    color: #f3f4f6;
}

.procargo-profile__option svg {
    display: none;
    color: #5EC7F2;
    flex-shrink: 0;
}

.procargo-profile__option.active svg {
    display: block;
}

.procargo-profile__current-settings {
    margin-top: 1.25rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

body.dark-theme .procargo-profile__current-settings {
    background: #374151;
    border-color: #4b5563;
}

.procargo-profile__current-settings h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.5rem;
}

body.dark-theme .procargo-profile__current-settings h4 {
    color: #d1d5db;
}

.procargo-profile__current-settings p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0.25rem 0;
}
