/* ========================================
   MULTI-TAB SYSTEM STYLES
   For Wardrobe Designer Pro
   ======================================== */

/* ========== TAB BAR ========== */
.multi-tab-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-bottom: 1px solid #334155;
    overflow-x: auto;
    flex-wrap: nowrap;
    min-height: 44px;
}

.tab-list {
    display: flex;
    gap: 0.35rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
}

/* Scrollbar for tab list */
.tab-list::-webkit-scrollbar {
    height: 4px;
}

.tab-list::-webkit-scrollbar-track {
    background: #0f172a;
}

.tab-list::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 2px;
}

/* ========== TAB ITEM ========== */
.tab-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 120px;
    max-width: 200px;
    position: relative;
    user-select: none;
}

.tab-item:hover {
    background: #253449;
    border-color: #475569;
}

.tab-item.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #0f172a;
}

.tab-code {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    color: #94a3b8;
    letter-spacing: 0.5px;
}

.tab-item.active .tab-code {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.tab-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.tab-item.active .tab-name {
    color: white;
}

.tab-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    background: #334155;
    border-radius: 10px;
    color: #94a3b8;
    min-width: 20px;
    text-align: center;
}

.tab-item.active .tab-badge {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* ========== TAB ACTIONS ========== */
.tab-actions {
    display: flex;
    gap: 0.15rem;
    opacity: 0;
    transition: opacity 0.15s;
    margin-left: auto;
}

.tab-item:hover .tab-actions {
    opacity: 1;
}

.tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.7rem;
    color: #94a3b8;
    transition: all 0.15s;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.tab-btn.tab-close:hover {
    background: #ef4444;
    color: white;
}

/* ========== TAB CONTROLS ========== */
.tab-controls {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-add-tab {
    padding: 0.4rem 0.8rem;
    background: #22c55e;
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-add-tab:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

.btn-consolidated {
    padding: 0.4rem 0.8rem;
    background: #8b5cf6;
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-consolidated:hover {
    background: #7c3aed;
    transform: translateY(-1px);
}

/* ========== MODAL STYLES ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    max-width: 95vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.consolidated-modal {
    width: 1200px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(180deg, #253449 0%, #1e293b 100%);
    border-bottom: 1px solid #334155;
}

.modal-header h2 {
    font-size: 1.1rem;
    color: #f8fafc;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #334155;
    border: none;
    border-radius: 6px;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.15s;
}

.modal-close:hover {
    background: #ef4444;
    color: white;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

/* ========== TABS SUMMARY ========== */
.consolidated-tabs-summary {
    margin-bottom: 1.5rem;
}

.consolidated-tabs-summary h3 {
    font-size: 0.9rem;
    color: #e2e8f0;
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #334155;
}

.tabs-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.tab-summary-card {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 0.75rem;
    transition: all 0.15s;
}

.tab-summary-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
}

.tab-summary-code {
    font-size: 0.7rem;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 0.25rem;
    letter-spacing: 0.5px;
}

.tab-summary-name {
    font-size: 0.85rem;
    color: #e2e8f0;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.tab-summary-stats {
    display: flex;
    gap: 0.75rem;
    font-size: 0.7rem;
    color: #64748b;
}

.tab-summary-stats span {
    padding: 0.15rem 0.4rem;
    background: #1e293b;
    border-radius: 4px;
}

/* ========== CONSOLIDATED CUTLIST ========== */
.consolidated-cutlist {
    margin-bottom: 1rem;
}

.consolidated-cutlist h3 {
    font-size: 0.9rem;
    color: #e2e8f0;
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #334155;
}

.cutlist-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.cutlist-actions .btn-secondary {
    padding: 0.5rem 1rem;
    background: #334155;
    border: 1px solid #475569;
    color: #e2e8f0;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.cutlist-actions .btn-secondary:hover {
    background: #475569;
    border-color: #64748b;
}

.cutlist-actions .btn-primary {
    padding: 0.5rem 1rem;
    background: #3b82f6;
    border: none;
    color: white;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.cutlist-actions .btn-primary:hover {
    background: #2563eb;
}

.cutlist-actions .btn-success {
    padding: 0.5rem 1rem;
    background: #22c55e;
    border: none;
    color: white;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.cutlist-actions .btn-success:hover {
    background: #16a34a;
}

.consolidated-table-wrapper {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #334155;
    border-radius: 6px;
}

/* Table styles for consolidated view */
.cutlist-table.consolidated {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.cutlist-table.consolidated th {
    position: sticky;
    top: 0;
    background: #0f172a;
    padding: 0.6rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: #e2e8f0;
    border-bottom: 2px solid #3b82f6;
    z-index: 10;
}

.cutlist-table.consolidated td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #1e293b;
    color: #cbd5e1;
}

.cutlist-table.consolidated tr:hover {
    background: rgba(59, 130, 246, 0.1);
}

.cutlist-table.consolidated .category-header {
    background: #0f172a;
}

.cutlist-table.consolidated .category-header td {
    padding: 0.6rem;
    color: #fbbf24;
    border-bottom: 1px solid #334155;
}

.cutlist-table.consolidated .piece-no {
    font-size: 0.8rem;
    font-weight: 600;
    width: 50px;
    text-align: left;
    color: #e2e8f0;
}

.cutlist-table.consolidated .desc-cell {
    max-width: 200px;
}

.cutlist-table.consolidated .key-cell {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.8rem;
    color: #60a5fa;
    white-space: nowrap;
}

.cutlist-table.consolidated .dim-cell {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.8rem;
    color: #e2e8f0;
    text-align: right;
    padding-right: 12px;
}

.cutlist-table.consolidated .qty-cell {
    text-align: center;
    color: #22c55e;
    font-weight: 600;
}

.cutlist-table.consolidated .labels-cell {
    font-size: 0.8rem;
    color: #f97316;
    font-family: 'Monaco', 'Consolas', monospace;
}

/* ========== CONSOLIDATED SUMMARY ========== */
.consolidated-summary {
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
    font-size: 0.85rem;
    color: #e2e8f0;
}

.consolidated-summary strong {
    color: #3b82f6;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .multi-tab-bar {
        padding: 0.3rem 0.5rem;
    }

    .tab-item {
        min-width: 80px;
        max-width: 120px;
        padding: 0.3rem 0.4rem;
    }

    .tab-name {
        max-width: 60px;
        font-size: 0.7rem;
    }

    .tab-controls {
        flex-direction: column;
        gap: 0.25rem;
    }

    .consolidated-modal {
        width: 100%;
    }

    .tabs-summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .cutlist-actions {
        flex-direction: column;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes tabPulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.tab-item.active {
    animation: tabPulse 2s ease-out;
}

/* Tab transition animations */
.tab-item {
    transform: translateY(0);
}

.tab-item:active {
    transform: translateY(1px);
}

/* Saving indicator */
.tab-item.saving::after {
    content: '●';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 6px;
    color: #22c55e;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ========== PER-TAB CUTLIST SECTION ========== */
.tab-cutlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-bottom: 1px solid #334155;
    margin-bottom: 0.5rem;
}

.tab-cutlist-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-cutlist-title .tab-indicator {
    padding: 0.15rem 0.4rem;
    background: #3b82f6;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
}

.tab-cutlist-title span {
    font-size: 0.85rem;
    color: #e2e8f0;
}

.tab-cutlist-actions {
    display: flex;
    gap: 0.35rem;
}

.tab-cutlist-actions button {
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
    background: #334155;
    border: 1px solid #475569;
    border-radius: 4px;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.15s;
}

.tab-cutlist-actions button:hover {
    background: #475569;
}

.tab-cutlist-actions button.primary {
    background: #3b82f6;
    border-color: #3b82f6;
}

.tab-cutlist-actions button.primary:hover {
    background: #2563eb;
}
