/* =============================================
   Shared Styles for Plan Setup Wizard Components
   ============================================= */

/* Custom textbox styling - Scoped to wizard content to prevent side effects */
.wizard-content .form-control,
.wizard-content input.form-control,
.wizard-content select.form-control,
.wizard-content textarea.form-control {
    background-color: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
    color: #111827;
    font-size: 1rem;
}

.wizard-content .form-control:hover,
.wizard-content input.form-control:hover,
.wizard-content select.form-control:hover,
.wizard-content textarea.form-control:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.wizard-content .form-control:focus,
.wizard-content input.form-control:focus,
.wizard-content select.form-control:focus,
.wizard-content textarea.form-control:focus {
    background-color: #ffffff;
    border-color: #06b6d4;
    border-width: 2px;
    outline: none;
    box-shadow: none;
    padding: calc(0.5rem - 1px) calc(0.75rem - 1px);
}

.wizard-content .form-control:disabled,
.wizard-content input.form-control:disabled {
    background-color: #f9fafb;
    border-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Placeholder styling */
.wizard-content .form-control::placeholder,
.wizard-content input.form-control::placeholder,
.wizard-content textarea.form-control::placeholder {
    color: #4b5563;
    opacity: 1;
    font-size: 1.125rem;
}

.wizard-content .form-control:focus::placeholder,
.wizard-content input.form-control:focus::placeholder,
.wizard-content textarea.form-control:focus::placeholder {
    color: #9ca3af;
}

/* Label styling */
.wizard-content label,
.wizard-content .form-label {
    font-size: 1rem;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

/* Floating label styling */
.wizard-content .form-floating {
    position: relative;
}

.wizard-content .form-floating > .form-control,
.wizard-content .form-floating > input.form-control {
    height: calc(3.5rem + 2px);
    line-height: 1.25;
    padding: 1.625rem 0.75rem 0.625rem;
}

.wizard-content .form-floating > label {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    padding: 1rem 0.75rem;
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
    color: #4b5563;
    font-size: 1rem;
}

.wizard-content .form-floating > .form-control:focus ~ label,
.wizard-content .form-floating > input.form-control:focus ~ label {
    opacity: 1;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
    color: #06b6d4;
}

.wizard-content .form-floating > .form-control:not(:placeholder-shown):not(:focus) ~ label,
.wizard-content .form-floating > input.form-control:not(:placeholder-shown):not(:focus) ~ label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
    color: #4b5563;
}

.wizard-content .form-floating > .form-control:focus,
.wizard-content .form-floating > input.form-control:focus {
    padding-top: 1.625rem;
    padding-bottom: 0.625rem;
}

/* =============================================
   Account Cards Grid Layout
   ============================================= */

.account-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.account-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    /* iOS Safari touch support */
    -webkit-tap-highlight-color: rgba(6, 182, 212, 0.1);
    touch-action: manipulation;
    user-select: none;
}

.account-card:hover {
    border-color: #06b6d4;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.15);
    transform: translateY(-2px);
}

.account-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.account-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

 .icon-retirement { background: #dbeafe; }
 .icon-ira { background: #e0e7ff; }
 .icon-broker { background: #dcfce7; }
 .icon-savings { background: #fef3c7; }
 .icon-hsa { background: #fce7f3; }
 .icon-education { background: #f3e8ff; }
 .icon-default { background: #f3f4f6; }

.account-info {
    flex: 1;
    min-width: 0;
}

.account-name {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-type-badge {
    font-size: 0.75rem;
    color: #6b7280;
    background: #f3f4f6;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

.btn-remove {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.btn-remove:hover {
    color: #ef4444;
}

.account-card-body {
    flex: 1;
}

.account-balance {
    margin-bottom: 0.75rem;
}

.balance-label {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.balance-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.account-details {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.7rem;
    color: #9ca3af;
    text-transform: uppercase;
}

.detail-value {
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
}

.account-card-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
}

.edit-hint {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Add Account Card */
.add-account-card {
    border: 2px dashed #d1d5db;
    background: #fafafa;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* iOS Safari touch support */
    -webkit-tap-highlight-color: rgba(6, 182, 212, 0.1);
    touch-action: manipulation;
    user-select: none;
}

.add-account-card:hover {
    border-color: #06b6d4;
    background: #f0fdfa;
}

.add-account-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
}

.add-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 300;
    color: #6b7280;
    transition: all 0.2s;
}

.add-account-card:hover .add-icon {
    background: #06b6d4;
    color: white;
}

/* =============================================
   Account Editor Modal
   ============================================= */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

.account-editor-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 1050;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.account-editor-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.account-editor-modal .modal-header h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.btn-close-modal:hover {
    color: #111827;
}

.account-editor-modal .modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.form-section {
    margin-bottom: 1.5rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row.single {
    grid-template-columns: 1fr;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.375rem;
}

.form-hint {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.input-with-prefix,
.input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix {
    position: absolute;
    left: -0.75rem;
    color: #6b7280;
    pointer-events: none;
    z-index: 1;
}

.input-prefix::before {
    content: "$";
}

.input-suffix {
    position: absolute;
    right: 0.75rem;
    color: #6b7280;
    pointer-events: none;
}

.input-with-prefix .form-control {
    padding-left: 1.75rem;
}

.input-with-prefix .form-control:focus {
    padding-left: calc(1.75rem - 1px);
}

.input-with-suffix .form-control {
    padding-right: 2rem;
}

.input-with-suffix .form-control:focus {
    padding-right: calc(2rem - 1px);
}

.account-editor-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 16px 16px;
}

@media (max-width: 576px) {
    .account-cards-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .account-editor-modal {
        width: 95%;
        max-height: 95vh;
    }
}

/* =============================================
   Generic Item Cards (for all entity types)
   ============================================= */

.item-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.item-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    /* iOS Safari touch support */
    -webkit-tap-highlight-color: rgba(6, 182, 212, 0.1);
    touch-action: manipulation;
    user-select: none;
}

.item-card:hover {
    border-color: #06b6d4;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.15);
    transform: translateY(-2px);
}

.item-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    background: #f3f4f6;
}

.icon-property { background: #dbeafe; }
.icon-debt { background: #fee2e2; }
.icon-income { background: #dcfce7; }
.icon-pension { background: #fef3c7; }
.icon-ss { background: #e0e7ff; }
.icon-expense { background: #fce7f3; }

.item-info {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-type-badge {
    font-size: 0.75rem;
    color: #6b7280;
    background: #f3f4f6;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.debt-badge { background: #fee2e2; color: #991b1b; }
.income-badge { background: #dcfce7; color: #166534; }
.pension-badge { background: #fef3c7; color: #92400e; }
.expense-badge { background: #fce7f3; color: #9d174d; }

.item-card-body {
    flex: 1;
}

.item-primary-value {
    margin-bottom: 0.5rem;
}

.item-secondary-value,
.item-equity {
    margin-bottom: 0.25rem;
}

.value-label {
    display: block;
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.value-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.value-amount.positive { color: #059669; }
.value-amount.negative { color: #dc2626; }

.item-secondary-value .value-amount,
.item-equity .value-amount {
    font-size: 1rem;
    font-weight: 600;
}

.frequency-suffix {
    font-size: 0.875rem;
    font-weight: 400;
    color: #6b7280;
}

.item-details {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.detail-item .highlight {
    color: #0891b2;
    font-weight: 600;
}

.detail-item .high-rate {
    color: #dc2626;
    font-weight: 600;
}

.item-card-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
}

/* Add Item Card */
.add-item-card {
    border: 2px dashed #d1d5db;
    background: #fafafa;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* iOS Safari touch support */
    -webkit-tap-highlight-color: rgba(6, 182, 212, 0.1);
    touch-action: manipulation;
    user-select: none;
}

.add-item-card:hover {
    border-color: #06b6d4;
    background: #f0fdfa;
}

.add-item-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
}

/* =============================================
   Generic Editor Modal
   ============================================= */

.editor-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 1050;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.editor-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.editor-modal .modal-header h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.editor-modal .modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.editor-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 16px 16px;
}

@media (max-width: 576px) {
    .item-cards-grid {
        grid-template-columns: 1fr;
    }
    
    .editor-modal {
        width: 95%;
        max-height: 95vh;
    }
}

/* confirm modal */
.delete-confirmation-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 1060;
    width: 90%;
    max-width: 480px;
    padding: 0;
    overflow: hidden;
}

.delete-confirmation-modal .modal-header {
    background: #fef2f2;
    color: #991b1b;
    border-bottom: 1px solid #fee2e2;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.delete-confirmation-modal .modal-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.delete-confirmation-modal .modal-body {
    padding: 2rem;
    text-align: center;
}

.warning-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.delete-confirmation-modal .modal-footer {
    background: #f9fafb;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-top: 1px solid #e5e7eb;
}

