/* Invoice Tabs CSS - Extracted from invoice_editor_style.css */

/* Tab Bar (Browser-style) - Premium Glassmorphism */
.invoice-tabs-bar {
    background: linear-gradient(to right, #0f172a, #1a2333);
    display: flex;
    align-items: flex-end;
    padding: 0.4rem 0.6rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.invoice-tabs-container {
    display: flex !important;
    gap: 0.35rem;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: thin;
}

.invoice-tab {
    background: rgba(30, 41, 59, 0.6);
    color: #cbd5e1;
    padding: 0.5rem 1rem;
    border-radius: 10px 10px 0 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 150px;
    max-width: 220px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: none;
    backdrop-filter: blur(4px);
}

.invoice-tab:hover {
    background: rgba(51, 65, 85, 0.8);
    color: #ffffff;
    transform: translateY(-1px);
}

.invoice-tab.active {
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 700;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.05);
}

.invoice-tab.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 4px;
    background: linear-gradient(90deg, #f97316, #ef4444) !important;
    border-radius: 0 0 8px 8px !important;
    box-shadow: 0 3px 10px rgba(249, 115, 22, 0.45) !important;
    animation: elasticTabIndicator 0.32s cubic-bezier(0.34, 1.6, 0.64, 1) forwards;
}

/* Edit Tab Styling */
.invoice-tab.tab-edit {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

.invoice-tab.tab-edit .tab-title::before {
    content: '\f303';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 6px;
    color: #3b82f6;
    font-size: 0.75rem;
}

.invoice-tab.tab-edit.active {
    background: #eff6ff;
}

.invoice-tab.tab-edit.active::before {
    background: linear-gradient(90deg, #3b82f6, #06b6d4) !important;
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.45) !important;
}

/* Specific Return Edit Styling (Red/Crimson) */
.invoice-tab.tab-return-edit {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

.invoice-tab.tab-return-edit .tab-title::before {
    content: '\f112';
    /* Reply/Return icon */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 6px;
    color: #ef4444;
    font-size: 0.75rem;
}

.invoice-tab.tab-return-edit.active {
    background: #fef2f2;
}

.invoice-tab.tab-return-edit.active::before {
    background: linear-gradient(90deg, #ef4444, #f43f5e) !important;
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.45) !important;
}

@keyframes elasticTabIndicator {
    0% {
        width: 0;
        opacity: 0;
    }
    100% {
        width: 50px;
        opacity: 1;
    }
}

.tab-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.82rem;
    letter-spacing: 0.2px;
}

.tab-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: inherit;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.82rem;
    opacity: 0.7;
}

.tab-close:hover {
    background: #ef4444;
    color: white;
    opacity: 1;
    transform: rotate(90deg);
}

.btn-new-tab {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    margin-left: 0.75rem;
    margin-bottom: 0.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    order: 9999;
    flex-shrink: 0;
}

.btn-new-tab:hover {
    background: #EF7722;
    color: white;
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 0 15px rgba(239, 119, 34, 0.4);
}

/* Mobile Tab Switcher - Hidden on Desktop */
.mobile-tab-switcher {
    display: none;
}

/* Mobile styles */
@media (max-width: 992px) {

    /* Mobile Tab Switcher - Enhanced */
    .mobile-tab-switcher {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        border: none;
        border-bottom: 2px solid #EF7722;
        padding: 0.75rem 1.25rem;
        color: #f1f5f9;
        font-size: 0.9rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        position: relative;
    }

    .mobile-tab-switcher::before {
        content: '\f0c9';
        font-family: 'Font Awesome 5 Free';
        font-weight: 600;
        margin-right: 0.75rem;
        color: #EF7722;
        font-size: 1rem;
    }

    .mobile-tab-switcher:active {
        background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
        transform: scale(0.99);
    }

    .active-tab-title {
        flex: 1;
        text-align: left;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-right: 0.75rem;
        letter-spacing: -0.01em;
    }

    .tab-count-badge {
        background: linear-gradient(135deg, #EF7722 0%, #D45D00 100%);
        color: white;
        font-size: 0.82rem;
        font-weight: 700;
        padding: 0.35rem 0.7rem;
        border-radius: 20px;
        min-width: 28px;
        text-align: center;
        box-shadow: 0 2px 6px rgba(239, 119, 34, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    /* Hide desktop tabs on mobile */
    .invoice-tabs-container {
        display: none !important;
    }

    /* Mobile Tab Popup */
    .mobile-tab-popup {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #0f172a;
        z-index: 9999;
        display: flex;
        flex-direction: column;
        animation: slideUp 0.3s ease-out;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .mobile-tab-popup-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem;
        background: #1e293b;
        border-bottom: 1px solid #334155;
    }

    .mobile-tab-popup-header h3 {
        color: #f1f5f9;
        font-size: 1.1rem;
        font-weight: 600;
        margin: 0;
    }

    .close-popup-btn {
        background: rgba(255, 255, 255, 0.1);
        border: none;
        color: #cbd5e1;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s;
    }

    .close-popup-btn:active {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(0.95);
    }

    .mobile-tab-list {
        overflow-y: auto;
        padding: 1rem;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-tab-card {
        background: linear-gradient(135deg, #1e293b 0%, #1a2332 100%);
        border: 2px solid #334155;
        border-radius: 16px;
        padding: 1.25rem;
        margin-bottom: 1rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);
        position: relative;
        overflow: hidden;
    }

    .mobile-tab-card::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background: transparent;
        transition: all 0.3s ease;
    }

    .mobile-tab-card.active::before {
        background: linear-gradient(180deg, #EF7722 0%, #D45D00 100%);
    }

    .mobile-tab-card.active {
        border-color: #EF7722;
        background: linear-gradient(135deg, #2d3748 0%, #1e293b 100%);
        box-shadow: 0 6px 20px rgba(239, 119, 34, 0.25), 0 2px 6px rgba(0, 0, 0, 0.15);
        transform: translateY(-2px);
    }

    .mobile-tab-card:active {
        transform: scale(0.98);
    }

    .mobile-tab-card-content {
        flex: 1;
        margin-right: 0.75rem;
    }

    .mobile-tab-card-title {
        color: #f1f5f9;
        font-size: 1rem;
        font-weight: 700;
        margin-bottom: 0.35rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        letter-spacing: -0.02em;
    }

    .mobile-tab-card.active .mobile-tab-card-title {
        color: #EF7722;
        text-shadow: 0 0 20px rgba(239, 119, 34, 0.3);
    }

    .mobile-tab-card-meta {
        color: #94a3b8;
        font-size: 0.82rem;
    }

    /* Mobile Edit Tab */
    .mobile-tab-card.tab-edit {
        border-left: 4px solid #3b82f6;
    }

    .mobile-tab-card.tab-edit .mobile-tab-card-title {
        color: #93c5fd;
    }

    .mobile-tab-card.tab-edit .mobile-tab-card-title::before {
        content: '\f303';
        font-family: 'Font Awesome 5 Free';
        font-weight: 900;
        margin-right: 8px;
        color: #3b82f6;
    }

    .mobile-tab-card.tab-edit.active {
        border-color: #3b82f6;
        background: linear-gradient(135deg, #1e3a8a 0%, #1e293b 100%);
    }

    .mobile-tab-card.tab-edit.active .mobile-tab-card-title {
        color: #60a5fa;
    }

    /* Mobile Return Edit Tab */
    .mobile-tab-card.tab-return-edit {
        border-left: 4px solid #ef4444;
    }

    .mobile-tab-card.tab-return-edit .mobile-tab-card-title {
        color: #fca5a5;
    }

    .mobile-tab-card.tab-return-edit .mobile-tab-card-title::before {
        content: '\f112';
        font-family: 'Font Awesome 5 Free';
        font-weight: 900;
        margin-right: 8px;
        color: #ef4444;
    }

    .mobile-tab-card.tab-return-edit.active {
        border-color: #ef4444;
        background: linear-gradient(135deg, #7f1d1d 0%, #1e293b 100%);
    }

    .mobile-tab-card.tab-return-edit.active .mobile-tab-card-title {
        color: #f87171;
    }

    .mobile-tab-close {
        background: rgba(239, 68, 68, 0.15);
        border: 1.5px solid rgba(239, 68, 68, 0.4);
        color: #ef4444;
        width: 38px;
        height: 38px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        flex-shrink: 0;
        box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2);
    }

    .mobile-tab-close:active {
        background: rgba(239, 68, 68, 0.3);
        transform: scale(0.92) rotate(90deg);
        box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
    }

    .mobile-new-tab-btn {
        background: linear-gradient(135deg, #EF7722 0%, #D45D00 100%);
        color: white;
        border: none;
        padding: 1.1rem;
        margin: 1.25rem;
        border-radius: 16px;
        font-size: 1.05rem;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.6rem;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 6px 16px rgba(239, 119, 34, 0.35), 0 2px 4px rgba(0, 0, 0, 0.1);
        letter-spacing: 0.02em;
        text-transform: uppercase;
        font-size: 0.9rem;
    }

    .mobile-new-tab-btn:active {
        transform: scale(0.97) translateY(1px);
        box-shadow: 0 3px 10px rgba(239, 119, 34, 0.35), 0 1px 2px rgba(0, 0, 0, 0.1);
    }
}

/* Item History & Margin Indicators */
.rate-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.rate-input-wrapper .row-price {
    padding-right: 18px !important;
    width: 100%;
}

.margin-indicator {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 7px;
    height: 7px;
    background: #ef4444;
    border-radius: 50%;
    display: none;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
    animation: pulse-red 2s infinite;
    pointer-events: none;
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.row-price.margin-warning {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}