/* ============================================================
   BrokerApp - Global Styles
   ============================================================ */

/* --- Form Validation --- */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

/* --- Blazor Error UI --- */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* --- Loading Progress --- */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}


/* ============================================================
   Page Transition Animation
   ============================================================ */
@keyframes page-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-content {
    animation: page-enter 0.28s cubic-bezier(0.25, 0.1, 0.25, 1) both;
}


/* ============================================================
   Bottom Tab Bar
   ============================================================ */
.bottom-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1100;
    border-top: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 6px 12px;
    min-width: 56px;
    color: var(--mud-palette-text-secondary);
    transition: color 0.2s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.tab-item:active {
    transform: scale(0.92);
}

.tab-item.active {
    color: var(--mud-palette-tertiary);
}

.tab-item.active::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--mud-palette-tertiary);
}

.tab-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.2;
    white-space: nowrap;
}


/* ============================================================
   More Bottom Sheet
   ============================================================ */
.more-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1250;
    background: var(--mud-palette-surface);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(0);
    animation: sheet-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    max-height: 85vh;
    overflow-y: auto;
}

@keyframes sheet-slide-up {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.more-sheet-handle {
    display: flex;
    justify-content: center;
    padding: 12px 0 8px;
    cursor: pointer;
}

.handle-bar {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--mud-palette-action-default);
    opacity: 0.4;
}

.more-sheet-content {
    padding: 4px 8px 8px;
}

.more-sheet-item {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 14px 16px;
    border-radius: 12px;
    color: var(--mud-palette-text-primary);
    transition: background 0.15s ease;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}

.more-sheet-item:hover {
    background: var(--mud-palette-action-default-hover);
}

.more-sheet-item:active {
    background: var(--mud-palette-action-default-hover);
}

.more-sheet-item-icon {
    color: var(--mud-palette-text-secondary);
    flex-shrink: 0;
}

.more-sheet-item-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.more-sheet-item-label {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
}

.more-sheet-item-desc {
    font-size: 12px;
    color: var(--mud-palette-text-secondary);
    line-height: 1.3;
}

.more-sheet-item-chevron {
    color: var(--mud-palette-text-secondary);
    opacity: 0.5;
    flex-shrink: 0;
}

.more-sheet-footer {
    padding: 4px 8px 12px;
    border-top: 1px solid var(--mud-palette-divider);
    margin: 4px 8px 0;
}

.more-sheet-theme-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    color: var(--mud-palette-text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.more-sheet-theme-row:hover {
    background: var(--mud-palette-action-default-hover);
}


/* ============================================================
   Responsive Layout: Mobile vs Desktop
   ============================================================ */
@media (max-width: 959.98px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    /* On mobile, pad the body content for the bottom tab bar */
    .mobile-body-padding {
        padding-bottom: 80px !important;
    }
}

@media (min-width: 960px) {
    .mobile-only {
        display: none !important;
    }

    .desktop-only {
        display: block !important;
    }
}


/* ============================================================
   Card Polish
   ============================================================ */
.mud-card {
    transition: box-shadow 0.2s ease;
}

@media (hover: hover) {
    .mud-card.cursor-pointer:hover {
        box-shadow: var(--mud-elevation-4) !important;
    }
}


/* ============================================================
   AppBar Logo
   ============================================================ */
.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
    font-weight: 600;
    letter-spacing: -0.01em;
}


/* ============================================================
   Portfolio Dashboard — Holdings List
   ============================================================ */
.holding-row {
    transition: background 0.15s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.holding-row:hover {
    background: var(--mud-palette-action-default-hover);
}

.holding-row:active {
    background: var(--mud-palette-action-default-hover);
}

.holding-row-alt {
    background: rgba(0, 0, 0, 0.018);
}

.mud-dark .holding-row-alt {
    background: rgba(255, 255, 255, 0.025);
}

.holding-row-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
}

.ticker-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 36px;
    border-radius: 8px;
    background: var(--mud-palette-gray-light);
    border: 1px solid var(--mud-palette-divider);
    flex-shrink: 0;
    padding: 0 8px;
    letter-spacing: 0.03em;
}

.allocation-bar-track {
    height: 3px;
    background: var(--mud-palette-divider);
    border-radius: 2px;
    margin: 4px 0;
    overflow: hidden;
}

.allocation-bar-fill {
    height: 100%;
    background: var(--mud-palette-tertiary);
    border-radius: 2px;
    transition: width 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
    min-width: 4px;
}


/* ============================================================
   Portfolio Dashboard — Activity Feed
   ============================================================ */
.activity-row {
    transition: background 0.15s ease;
}

.activity-row-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon-buy {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.activity-icon-sell {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}