/* ======================
   ORDER PAGE STYLES - Match Bond Detail Exact Layout
   ====================== */

/* Overlay */
.order-page-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.order-page-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Main Panel - Exact copy from bond detail */
.order-page-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    height: 100vh;
    background-color: #000;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 999;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.order-page-panel.show {
    transform: translateX(0);
}

/* Panel Content Container - Match bond detail */
.order-panel-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Close Button - Match bond detail */
.order-panel-close {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    width: 24px;
    height: 24px;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.order-panel-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Header - Exact copy from bond detail */
.order-panel-header {
    padding: 0.8rem 1rem;
    padding-top: 2.2rem; /* Space for close button */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.order-title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: lowercase;
    margin-bottom: 0.1rem;
}

.order-subtitle {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: capitalize;
    margin-bottom: 0.6rem;
}

/* Scrollable Sections Container - Match bond detail */
.order-panel-sections {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.6rem 0.8rem; /* 12.8px (0.8rem) left and right */
    padding-bottom: 140px; /* Space for yield module + action buttons */
}

/* Last Traded Info - Match bond detail quick highlight */
.order-last-traded-info {
    margin-bottom: 0.4rem;
}

.last-traded-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0.6rem;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.last-traded-item {
    flex: 1;
}

.last-traded-label {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.05rem;
}

.last-traded-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
}

.last-traded-divider {
    width: 1px;
    height: 16px;
    background-color: rgba(255, 255, 255, 0.2);
}

/* Broker Selection */
.broker-selection {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.broker-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.7rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.broker-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.broker-btn.active {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

/* Exchange Toggle */
.exchange-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.exchange-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.7rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.exchange-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.exchange-btn.active {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.exchange-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.3);
}

.exchange-btn.disabled:hover {
    background-color: rgba(255, 255, 255, 0.02);
    color: rgba(255, 255, 255, 0.3);
    transform: none;
}

/* Content Grid */
.order-content-grid {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 0.4rem;
}

.order-form-column {
    flex: 1;
    max-width: 50%; /* Ensure form doesn't exceed 50% of panel width */
}

.market-depth-column {
    flex: 1;
    max-width: 50%;
}

/* Order Form */
.order-form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.order-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.order-field-label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
}

.order-field-input-group {
    display: flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    background-color: rgba(255, 255, 255, 0.05);
    overflow: hidden;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 100%;
}

.order-field-input-group:focus-within {
    border-color: rgba(255, 255, 255, 0.4);
    background-color: rgba(255, 255, 255, 0.08);
}

.order-field-btn {
    width: 24px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
}

.order-field-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.order-field-input {
    flex: 1;
    height: 32px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    outline: none;
    padding: 0 0.25rem;
    min-width: 0;
}

/* Quantity Preset Buttons */
.quantity-presets {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.preset-btn {
    flex: 1;
    padding: 0.4rem;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.preset-btn.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

/* Order Cost Text in Form - Match cost summary styling */
.order-cost-text {
    margin-top: 0.4rem;
    font-size: 0.7rem; /* Match cost summary font size */
    font-weight: 400; /* Match cost summary font weight */
    color: rgba(255, 255, 255, 0.7); /* Match cost summary color */
    text-align: left;
    line-height: 1.4; /* Match cost summary line height */
}

.order-value-note {
    display: block;
    margin-top: 0.4rem;
    color: rgba(255, 200, 120, 0.85);
}

/* Market Depth - Match bond detail order book styling */
.vertical-market-depth {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.02);
}

.market-depth-section {
    position: relative;
}

.market-depth-section.asks-section {
    background: linear-gradient(180deg, rgba(255, 68, 68, 0.02) 0%, transparent 100%);
}

.market-depth-section.bids-section {
    background: linear-gradient(180deg, transparent 0%, rgba(0, 255, 136, 0.02) 100%);
}

.market-depth-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 0.4rem 0.6rem;
    background-color: rgba(255, 255, 255, 0.05);
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.market-depth-header span {
    text-align: center;
}

.market-depth-header span:first-child {
    text-align: left;
}

.market-depth-header span:last-child {
    text-align: right;
}

.market-depth-rows {
    display: flex;
    flex-direction: column;
    max-height: 200px;
    overflow: hidden;
}

.market-depth-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.market-depth-row:last-child {
    border-bottom: none;
}

.market-depth-row span {
    text-align: center;
}

.market-depth-row span:first-child {
    text-align: left;
}

.market-depth-row span:last-child {
    text-align: right;
}

.market-depth-row.clickable {
    cursor: pointer;
}

.market-depth-row.clickable:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.market-depth-row.ask-row:hover {
    background-color: rgba(255, 68, 68, 0.1);
}

.market-depth-row.bid-row:hover {
    background-color: rgba(0, 255, 136, 0.1);
}

/* Last Traded Separator */
.last-traded-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.8rem 1rem;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.06) 50%, rgba(255, 255, 255, 0.02) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    font-weight: 600;
    position: relative;
}

.last-traded-separator::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
}

.last-traded-price {
    color: #fff;
    font-weight: 700;
}

.last-traded-yield {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
}

/* Clickable Last Traded Separator */
.clickable-last-traded {
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.clickable-last-traded:hover {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.04) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.clickable-last-traded:active {
    transform: translateY(0);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.02) 100%);
}

/* Cost Summary */
/* Highly specific selectors to override any inherited styles */
.order-panel-sections .bond-maturity-info,
div.bond-maturity-info,
.order-form-column .bond-maturity-info {
    font-size: 0.7rem !important;
    line-height: 1.4 !important;
    color: rgba(255, 255, 255, 0.6) !important;
    margin-bottom: 1.5rem !important;
    font-family: inherit !important;
}

.order-panel-sections .portal-confirmation-info,
div.portal-confirmation-info,
.order-form-column .portal-confirmation-info {
    font-size: 0.7rem !important;
    line-height: 1.4 !important;
    color: rgba(255, 255, 255, 0.6) !important;
    padding-top: 0.5rem !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    margin-top: 0 !important;
    font-family: inherit !important;
}

.order-cost-text strong {
    color: #fff !important;
    font-weight: 700;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
}

/* Available Yield & Price Module - Exact copy from bond detail */
.available-yield-price-module {
    position: absolute;
    bottom: 70px; /* Above the action buttons with more space */
    left: 0;
    right: 0;
    padding: 0.8rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 5;
    min-height: auto; /* Ensure module can expand */
    max-height: none; /* Remove any height restrictions */
    overflow: visible; /* Ensure content is not clipped */
}

.yield-price-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0.6rem;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-bottom: 0.5rem;
}

.yield-price-row:last-child {
    margin-bottom: 0;
}

.yield-price-item {
    flex: 1;
}

.yield-price-label {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.05rem;
}

.yield-price-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
}

.yield-price-divider {
    width: 1px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

/* Action Buttons - Exact copy from bond detail */
.order-action {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    background-color: rgba(0, 0, 0, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.action-button {
    flex: 1;
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: lowercase;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Manrope', sans-serif;
}

.buy-button {
    background-color: #fff;
    color: #000;
}

.buy-button:hover {
    background-color: #e6e6e6;
}

/* Disabled button state */
.action-button.disabled,
.action-button:disabled {
    background-color: #666666 !important;
    color: #999999 !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.action-button.disabled:hover,
.action-button:disabled:hover {
    background-color: #666666 !important;
    color: #999999 !important;
    transform: none !important;
}

/* Scrollbar Styling - Match bond detail */
.order-panel-sections::-webkit-scrollbar {
    width: 4px;
}

.order-panel-sections::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.order-panel-sections::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.order-panel-sections::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive Design - Match bond detail */
@media (max-width: 600px) {
    .order-page-panel {
        width: 100%;
    }

    .order-panel-header {
        padding: 1rem;
        padding-top: 2.5rem;
    }

    .order-panel-sections {
        padding: 0.6rem 1rem;
        padding-bottom: 140px;
    }

    .order-content-grid {
        flex-direction: column;
        gap: 1rem;
    }

    .order-form-column {
        max-width: 100%;
    }

    .order-form {
        flex-direction: row;
        gap: 0.8rem;
    }

    .order-field {
        flex: 1;
    }

    .last-traded-row {
        flex-direction: column;
        gap: 0.8rem;
    }

    .last-traded-divider {
        width: 40px;
        height: 1px;
    }

    .yield-price-row {
        flex-direction: column;
        gap: 0.8rem;
    }

    .yield-price-divider {
        width: 40px;
        height: 1px;
    }
}

/* Mobile responsive for yield price module - Match bond detail */
@media (max-width: 768px) {
    .yield-price-row {
        flex-direction: column;
        gap: 0.8rem;
        padding: 0.5rem 0.6rem;
    }

    .yield-price-divider {
        width: 40px;
        height: 1px;
    }
}
/* ======================
   MODIFY CONFIRMATION POPUP
   ====================== */
.modify-confirm-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modify-confirm-popup.show {
    opacity: 1;
}

.modify-confirm-content {
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 2rem;
    max-width: 450px;
    width: 90%;
}

.modify-confirm-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1.5rem;
    text-transform: lowercase;
}

.modify-changes {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.modify-change-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.modify-change-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: lowercase;
}

.modify-change-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.modify-confirm-actions {
    display: flex;
    gap: 0.75rem;
}

.modify-confirm-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-family: 'Manrope', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: lowercase;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modify-confirm-btn.secondary {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
}

.modify-confirm-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.modify-confirm-btn.primary {
    background: rgba(255, 183, 77, 0.1);
    color: #FFB74D;
    border-color: rgba(255, 183, 77, 0.3);
}

.modify-confirm-btn.primary:hover {
    background: rgba(255, 183, 77, 0.15);
    border-color: rgba(255, 183, 77, 0.4);
}

/* ======================
   ORDER CONFIRMATION POPUP
   ====================== */
.order-confirm-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.order-confirm-popup.show {
    opacity: 1;
}

.order-confirm-content {
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
}

.order-confirm-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1.5rem;
    text-transform: lowercase;
}

.order-confirm-bond {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.order-confirm-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: lowercase;
}

.order-confirm-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
}

.order-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.order-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.order-detail-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: lowercase;
}

.order-detail-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.order-detail-value.buy {
    color: #00ff88;
}

.order-detail-value.sell {
    color: #ff5555;
}

.order-confirm-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.order-confirm-total-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: lowercase;
}

.order-confirm-total-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.order-confirm-total-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.order-confirm-charges {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: lowercase;
}

.order-confirm-actions {
    display: flex;
    gap: 0.75rem;
}

.order-confirm-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-family: 'Manrope', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: lowercase;
    cursor: pointer;
    transition: all 0.2s ease;
}

.order-confirm-btn.secondary {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
}

.order-confirm-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.order-confirm-btn.primary {
    background: rgba(255, 183, 77, 0.1);
    color: #FFB74D;
    border-color: rgba(255, 183, 77, 0.3);
}

.order-confirm-btn.primary:hover {
    background: rgba(255, 183, 77, 0.15);
    border-color: rgba(255, 183, 77, 0.4);
}

/* Responsive */
@media (max-width: 600px) {
    .order-details-grid {
        grid-template-columns: 1fr;
    }
}
