:root {
    /* AutoCAD 2026 Technical Palette */
    --mt-header-bg: #0f172a;
    /* Tech Dark Navy */
    --mt-header-text: #ffffff;
    /* Bright White */
    --mt-accent: #3b82f6;
    /* Cad Blue */
    --mt-border: #334155;
    /* Tech Slate */
    --mt-row-odd: #ffffff;
    /* Pure White */
    --mt-row-even: #f1f5f9;
    /* Slate 50 - Tech Grey */
    --mt-text-main: #1e293b;
    /* Dark Slate */
    --mt-text-sec: #64748b;
    /* Muted Slate */
    --mt-hover-bg: #e2e8f0;
    /* Highlight Slate */
}

/* Specific AutoCAD overrides - Ensuring consistency */
:root {
    --mt-header-bg: #1e293b;
    /* Slightly lighter navy for better depth */
    --mt-accent: #0ea5e9;
    /* Brighter tech blue */
}

.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid var(--mt-border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
}

.modern-table thead {
    background-color: var(--mt-header-bg);
}

.modern-table th {
    color: var(--mt-header-text);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    padding: 12px 16px;
    border-bottom: 2px solid var(--mt-accent);
    white-space: nowrap;
    background-color: var(--mt-header-bg);
}

/* Row Styling */
.modern-table tbody tr:nth-of-type(odd) {
    background-color: var(--mt-row-odd);
}

.modern-table tbody tr:nth-of-type(even) {
    background-color: var(--mt-row-even);
}

/* Hover Effect */
.modern-table tbody tr:hover {
    background-color: var(--mt-hover-bg) !important;
    color: var(--mt-header-bg);
    box-shadow: inset 4px 0 0 var(--mt-accent);
}

.modern-table td {
    padding: 14px 20px;
    color: var(--mt-text-main);
    vertical-align: middle;
    border-bottom: 1px solid var(--mt-border);
}

.modern-table.compact th,
.modern-table.compact td {
    padding: 10px 14px;
    font-size: 0.88rem;
}

/* Typography */
.modern-table strong {
    color: #455a64;
    font-weight: 700;
}

/* Badges */
.badge-id {
    font-family: 'Consolas', 'Monaco', monospace;
    background-color: #ffecb3;
    color: #5d4037;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    border: none;
    font-weight: 600;
}

.modern-table .actions .btn-action {
    background: #ffffff;
    border: 1px solid #cfd8dc;
    color: #90a4ae;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
}

.modern-table .actions .btn-action:hover {
    background: #ffab91;
    color: white;
    border-color: #ffab91;
    transform: scale(1.1);
}

.modern-table .actions .btn-action.delete:hover {
    background: #ef5350;
    border-color: #ef5350;
    color: white;
}

.modern-table .badge {
    border-radius: 12px;
}

/* =========================================
   PREMIUM TECHNICAL DATA SHEET STYLES
   ========================================= */

.tech-sheet-container {
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    /* Smoother corners */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    /* Deep shadow */
    /* margin: 0 auto; */
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    overflow: hidden;
    /* max-width: 1400px; */
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tech-sheet-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    /* Premium Gradient */
    color: white;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #475569;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Subtle pattern in header */
.tech-sheet-header::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
    pointer-events: none;
    z-index: 1;
}

/* Position relative for elements receiving watermarks to contain them */
.tech-sheet-header,
.table-toolbar.has-bg,
.tech-header-banner {
    position: relative;
    overflow: hidden;
}

/* Background image watermarks for headers */
.tech-sheet-header::before,
.table-toolbar.has-bg::before,
.tech-header-banner::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-repeat: no-repeat;
    background-position: right 10% center;
    /* Shifted slightly left from the right edge */
    background-size: contain;
    opacity: 0.12;
    /* Subtle faint watermark */
    z-index: 0;
    pointer-events: none;
    mix-blend-mode: overlay;
    /* Make them blend subtly with the dark background */
}

/* Ensure header content is above watermarks */
.tech-sheet-header>*,
.table-toolbar.has-bg>*,
.tech-header-banner>* {
    position: relative;
    z-index: 2;
}

/* Specific background classes mapping to assets/img */
.bg-img-drone::before {
    background-image: url('../img/dji_mavic_3_enterprise.png');
    background-position: right 5% center;
    background-size: 40%;
    opacity: 0.2;
}

.bg-img-gnss::before {
    background-image: url('../img/gnss_receiver.png');
    background-position: right 15% center;
    background-size: 35%;
}

.bg-img-station::before {
    background-image: url('../img/total_station.png');
    background-position: right 15% center;
    background-size: 35%;
}

.bg-img-contour::before {
    background-image: url('../img/contour_lines_dark.png');
    background-size: cover;
    background-position: center;
    opacity: 0.15;
}

.tech-sheet-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    padding: 2rem;
    background-color: #ffffff;
    /* Technical Grid Pattern Background */
    background-image:
        linear-gradient(#f1f5f9 1px, transparent 1px),
        linear-gradient(90deg, #f1f5f9 1px, transparent 1px);
    background-size: 40px 40px;
}

@media (min-width: 1200px) {
    .tech-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.tech-header-row {
    grid-column: 1 / -1;
    background: #f8fafc;
    color: #1e293b;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    padding: 0.75rem 1rem;
    border-left: 4px solid #3b82f6;
    /* Bright Blue Accent */
    border-bottom: 1px solid #e2e8f0;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border-radius: 0 4px 4px 0;
    font-family: 'Outfit', sans-serif;
}

.tech-field {
    display: flex;
    flex-direction: column;
}

.tech-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
    display: flex;
    justify-content: space-between;
    letter-spacing: 0.02em;
}

.tech-input,
.tech-select,
.tech-textarea {
    background-color: #fff;
    border: 1.5px solid #cbd5e1;
    /* Thicker, defined border */
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    font-size: 0.95rem;
    color: #1e293b;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    font-family: 'Outfit', sans-serif;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    /* Subtle inner depth */
}

/* Currency/Number inputs get monospace font */
input[type="number"],
input[name*="price"],
input[name*="amount"],
input[name*="valuacion"],
.tech-input.text-danger,
.tech-input.text-success {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 600;
}

.tech-input:focus,
.tech-select:focus,
.tech-textarea:focus {
    background-color: #fff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    /* Modern Focus Ring */
    outline: none;
    transform: translateY(-1px);
}

.tech-input:hover,
.tech-select:hover,
.tech-textarea:hover {
    border-color: #94a3b8;
}

/* Readonly Styling */
.tech-input[readonly],
.tech-input[disabled] {
    background-color: #f1f5f9;
    border-color: #e2e8f0;
    color: #64748b;
    cursor: default;
    box-shadow: none;
}

.tech-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.tech-actions {
    background-color: #f8fafc;
    padding: 1.5rem 2rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    align-items: center;
}

/* Responsive Grid Helper */
.tech-grid .tech-field[style*="span 2"],
.tech-grid .tech-field[style*="span 3"] {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .tech-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .tech-grid .tech-field {
        grid-column: 1 / -1 !important;
    }

    .tech-sheet-header {
        padding: 1rem;
    }
}

/* MODULE TOOLBAR STANDARD */
.table-toolbar {
    background: #ffffff;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    border-radius: 12px 12px 0 0;
}

.search-box {
    position: relative;
    max-width: 400px;
    width: 100%;
}

/* TECHNICAL DESIGN SYSTEM - GLOBAL REFINEMENTS */
:root {
    --tech-bg: #fafafa;
    --tech-card: #ffffff;
    --tech-border: #e4e4e7;
    --tech-accent: #18181b;
    --tech-accent-hover: #09090b;
    --tech-label: #71717a;
    --tech-text: #27272a;
    --tech-input-bg: #ffffff;
    --tech-ring: rgba(24, 24, 27, 0.08);

    /* Professional Shadow System */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

/* Collapsible Technical Sections */
.tech-section-header {
    background: #f1f5f9;
    padding: 0.875rem 1.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-top: 1px solid var(--tech-border);
    border-bottom: 1px solid var(--tech-border);
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    position: relative;
    z-index: 2;
}

.tech-section-header:hover {
    background: #e2e8f0;
}

.tech-section-header i:first-child {
    width: 20px;
    margin-right: 0.75rem;
    color: var(--tech-accent);
}

.tech-section-header .toggle-icon {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.tech-section-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.tech-section-content {
    max-height: 4000px;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1);
}

.tech-section-content.collapsed {
    max-height: 0 !important;
    transition: max-height 0.4s cubic-bezier(1, 0, 1, 0);
}

/* TECHNICAL FORM ELEMENTS - GLOBAL */
.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
}

.tech-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tech-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--tech-label);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tech-input,
.tech-textarea {
    background: var(--tech-input-bg);
    border: 1.5px solid var(--tech-border);
    border-radius: 10px;
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    color: var(--tech-text);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.tech-input:focus,
.tech-textarea:focus {
    outline: none;
    border-color: var(--tech-accent);
    box-shadow: 0 0 0 4px var(--tech-ring);
    background: #ffffff;
}

.tech-textarea {
    min-height: 100px;
    resize: vertical;
}

.span-2 {
    grid-column: span 2;
}

.span-3 {
    grid-column: span 3;
}

.span-4 {
    grid-column: span 4;
}

/* Existing tech-header-row wrapper */
.tech-header-row {
    grid-column: 1 / -1;
    background: #f8fafc;
    padding: 0.6rem 1rem;
    font-size: 0.75rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

/* Legacy Header compatibility or quick enhancement */
.tech-header-row.collapsible {
    cursor: pointer;
    user-select: none;
}

.tech-header-row.collapsible::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.tech-header-row.collapsible.collapsed::after {
    transform: rotate(-90deg);
}