/* Modern Calculator Combo Styling - Fixed Version */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Global Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f0f4f8;
    color: #334155;
    line-height: 1.6;
}

/* Main Container - Constrained Width */
.calc-combo-container {
    max-width: 95%;
    width: fit-content;
    margin: 2rem auto;
    padding: 0;
    background-color: #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    overflow: hidden;
}

/* Header Section - Better Spacing */
.calc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem 2.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: none;
    gap: 3rem;
}

.calc-title {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.025em;
}

/* Back Button - Enhanced Styling */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background-color: rgba(255, 255, 255, 0.95);
    color: #667eea;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.back-button:hover {
    background-color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    color: #667eea;
    text-decoration: none;
    border-color: rgba(102, 126, 234, 0.2);
}

.back-button:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Controls Section - Better Spacing and Styling */
.calc-controls {
    background: linear-gradient(to bottom, #fafbfc 0%, #f8fafc 100%);
    padding: 2rem 2.5rem;
    border-bottom: 3px solid #e2e8f0;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

/* Dropdown Controls - Improved Layout */
.dropdown-flex-container {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.dropdown-item, .dropdown-container {
    display: flex;
    flex-direction: column;
    min-width: 280px;
}

.dropdown-item label, .dropdown-container label {
    display: block;
    margin-bottom: 0.625rem;
    font-weight: 600;
    color: #1e293b;
    font-size: 0.9375rem;
    letter-spacing: -0.01em;
}

.dropdown-item select, .dropdown-container select {
    padding: 0.875rem 1rem;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.9375rem;
    background-color: white;
    color: #374151;
    transition: all 0.2s ease;
    min-width: 280px;
    width: 100%;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.dropdown-item select:focus, .dropdown-container select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.dropdown-item select:hover, .dropdown-container select:hover {
    border-color: #94a3b8;
    background-color: #fafafa;
}

/* Studio Checkbox - Better Spacing */
.studio-checkbox-row {
    margin-top: 0;
    padding-top: 1.5rem;
}

.studio-checkbox-row label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    font-size: 0.9375rem;
    padding: 0.5rem 0;
}

.studio-checkbox-row input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.studio-checkbox-row input[type="checkbox"]:checked {
    background-color: #667eea;
    border-color: #667eea;
}

/* Tables Container - Constrained Width */
.tables-container {
    padding: 2rem 2.5rem;
    max-width: 100%;
    overflow-x: auto;
}

/* Table Section */
.table-section {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.table-section h2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 1.25rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    border-bottom: none;
    letter-spacing: -0.02em;
}

/* Modern Table Styling with Sticky Header */
.table-wrapper {
    overflow-x: auto;
    max-width: 100%;
    position: relative;
    max-height: 600px;
    overflow-y: auto;
}

.avedik-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9375rem;
    background-color: white;
    display: table;
}

.avedik-table th {
    background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%);
    color: #1e293b;
    font-weight: 700;
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 3px solid #cbd5e1;
    border-right: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: normal;
    hyphens: none;
    font-size: 0.75rem;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    line-height: 1.3;
    height: 3em;
    vertical-align: middle;
}

.avedik-table th:last-child {
    border-right: none;
}

.avedik-table td {
    padding: 0.875rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    white-space: nowrap;
    color: #374151;
    font-variant-numeric: tabular-nums;
    font-size: 0.9375rem;
    font-weight: 500;
}

.avedik-table td:last-child {
    border-right: none;
}

.avedik-table tbody tr {
    transition: all 0.15s ease;
}

.avedik-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.avedik-table tbody tr:hover {
    background-color: #eff6ff;
    box-shadow: inset 0 0 0 2px #dbeafe;
    transform: scale(1.001);
}

/* Special styling for first two columns (ID and Model) */
.avedik-table td:first-child {
    font-weight: 700;
    color: #1e293b;
    background-color: #f8fafc;
}

.avedik-table td:nth-child(2) {
    font-weight: 600;
    color: #667eea;
    background-color: #f8fafc;
}

.avedik-table tbody tr:hover td:first-child,
.avedik-table tbody tr:hover td:nth-child(2) {
    background-color: #dbeafe;
}

/* Thick black vertical separators ONLY for Measurements tables */
/* After Height D column (6th column: ID, Model, Length, Width, Height, Height D) */
[id$="_Measurements"] .avedik-table th:nth-child(6),
[id$="_Measurements"] .avedik-table td:nth-child(6) {
    border-right: 3px solid #000000 !important;
}

/* After Ext H D column (10th column: ...Height D, Ext L, Ext W, Ext H, Ext H D) */
[id$="_Measurements"] .avedik-table th:nth-child(10),
[id$="_Measurements"] .avedik-table td:nth-child(10) {
    border-right: 3px solid #000000 !important;
}

/* Bold Total Cost and Total Weight columns */
.avedik-table th.total-column,
.avedik-table td.total-column {
    font-weight: 700 !important;
    color: #1e293b !important;
    background-color: #fef3c7 !important;
}

.avedik-table tbody tr:hover td.total-column {
    background-color: #fde68a !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calc-combo-container {
        max-width: 100%;
        margin: 1rem;
        border-radius: 8px;
    }
    
    .calc-header {
        flex-direction: column;
        gap: 1.5rem;
        align-items: flex-start;
        padding: 1.5rem;
    }
    
    .calc-title {
        font-size: 1.5rem;
    }
    
    .calc-controls {
        padding: 1.5rem;
    }
    
    .dropdown-flex-container {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .dropdown-item, .dropdown-container {
        min-width: 100%;
    }
    
    .tables-container {
        padding: 1.5rem;
    }
    
    .avedik-table {
        font-size: 0.875rem;
    }
    
    .avedik-table th,
    .avedik-table td {
        padding: 0.75rem 0.625rem;
    }
}

/* Loading States */
.tabcontent {
    display: none;
}

.tabcontent.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ficha-Specific Styles */
.ficha-section {
    margin-bottom: 2rem;
}

.ficha-section h2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
    margin: 0 0 0 0;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 8px 8px 0 0;
    letter-spacing: -0.01em;
}

.technical-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9375rem;
    background-color: white;
    border: 2px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.technical-table th {
    background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%);
    color: #1e293b;
    font-weight: 600;
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 2px solid #cbd5e1;
    border-right: 1px solid #e5e7eb;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.technical-table th:last-child {
    border-right: none;
}

.technical-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    color: #374151;
    font-weight: 500;
}

.technical-table td:last-child {
    border-right: none;
}

.technical-table tbody tr {
    transition: all 0.15s ease;
}

.technical-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.technical-table tbody tr:hover {
    background-color: #eff6ff;
    box-shadow: inset 0 0 0 2px #dbeafe;
}

/* Ficha Table Column Styling */
.technical-table .id-column {
    width: 80px;
    font-weight: 700;
    color: #1e293b;
    background-color: #f8fafc;
}

.technical-table .model-number-description {
    font-weight: 500;
    color: #374151;
}

.technical-table .actions {
    width: 140px;
    white-space: nowrap;
    text-align: center;
}

.technical-table tbody tr:hover .id-column {
    background-color: #dbeafe;
}

/* Action Button Styling */
.ficha-action-btn {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    margin: 0 0.125rem;
    background-color: #3b82f6;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.ficha-action-btn:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    color: white;
    text-decoration: none;
}

.ficha-action-btn.pdf-btn {
    background-color: #dc2626;
}

.ficha-action-btn.pdf-btn:hover {
    background-color: #b91c1c;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

/* Print Styles */
@media print {
    .calc-header,
    .calc-controls,
    .back-button {
        display: none;
    }
    
    .calc-combo-container {
        box-shadow: none;
        padding: 0;
        max-width: 100%;
    }
    
    .avedik-table {
        font-size: 0.75rem;
    }
    
    .avedik-table th,
    .avedik-table td {
        padding: 0.25rem;
    }
    
    .technical-table {
        font-size: 0.75rem;
    }
    
    .technical-table th,
    .technical-table td {
        padding: 0.25rem;
    }
}
