/* File: /assets/css/style.css */

@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700;800&display=swap');

body {
    font-family: 'Quicksand', sans-serif;
    text-transform: uppercase;
    background-color: #f8f9fa;
    color: #212529;
    font-size: 0.875rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout & Containers */
.app-container {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.header-nav {
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-color: #f1f5f9 !important;
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.05em;
}

/* Modest Custom Sized Standard Buttons */
.btn-custom-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.025em;
    border-radius: 2px;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.btn-primary.btn-custom-sm {
    background-color: #1e293b;
    border-color: #1e293b;
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-primary.btn-custom-sm:hover,
.btn-primary.btn-custom-sm:focus {
    background-color: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
}

.btn-secondary.btn-custom-sm {
    background-color: #ffffff;
    border-color: #d1d5db;
    color: #374151;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-secondary.btn-custom-sm:hover,
.btn-secondary.btn-custom-sm:focus {
    background-color: #f9fafb;
    border-color: #c5c9d1;
    color: #1f2937;
}

/* Row Action Buttons replacing Inline Framework styles */
.btn-action-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 2px;
    font-weight: bold;
    font-size: 11px;
    text-decoration: none;
    cursor: pointer;
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    transition: all 0.15s ease;
}

.btn-action-open:hover {
    background-color: #e5e7eb;
    color: #1f2937;
}

.btn-action-share-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #4f46e5;
    border: 1px solid #4f46e5;
    background-color: #eef2ff;
    padding: 4px 10px;
    border-radius: 2px;
    font-weight: bold;
    font-size: 11px;
    transition: all 0.15s ease;
}

.btn-action-share-trigger:hover {
    background-color: #e0e7ff;
}

.btn-action-delete-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ef4444;
    border: 1px solid #ef4444;
    background-color: #fef2f2;
    padding: 4px 10px;
    border-radius: 2px;
    font-weight: bold;
    font-size: 11px;
    transition: all 0.15s ease;
}

.btn-action-delete-trigger:hover {
    background-color: #fee2e2;
}

/* Status Labels / Badges */
.badge-owner {
    background-color: #3b82f6;
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: bold;
}

.badge-shared {
    background-color: #10b981;
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: bold;
}

/* Main Core Data Tables */
.data-table-wrapper {
    border-color: #e5e7eb !important;
}

.data-table th {
    padding: 0.75rem 1.5rem;
    background-color: #f8fafc;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e2e8f0;
}

.data-table td {
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    color: #4b5563;
}

.empty-state {
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Custom Bootstrap Modal Layer Overrides */
.custom-modal-content {
    border-radius: 6px;
    border: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.custom-modal-header {
    margin-bottom: 1.25rem;
    padding: 1rem 1.5rem 0.75rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.custom-modal-title {
    font-size: 1rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.025em;
}

.custom-btn-close {
    font-size: 0.875rem;
}

/* Forms & Input Elements */
.custom-form-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.375rem;
}

.custom-form-input {
    border-radius: 2px;
    border: 1px solid #d1d5db;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-size: 0.75rem;
    padding: 0.625rem 0.75rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    normal-case: override;
    text-transform: none; /* Preserves explicit validation typography input mapping */
}

.custom-form-input:focus {
    border-color: #64748b;
    box-shadow: 0 0 0 0.2rem rgba(100, 116, 139, 0.25);
    outline: 0;
}

/* Auth Pages Framework Shell Structure */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f8f9fa;
}

.auth-card {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    width: 100%;
    max-width: 400px;
}

.auth-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 1.5rem;
    text-align: center;
    letter-spacing: 0.025em;
}

.auth-link {
    color: #4f46e5;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    display: block;
    margin-top: 1rem;
    transition: color 0.15s ease;
}

.auth-link:hover {
    color: #3730a3;
}

.alert-error {
    background-color: #fef2f2;
    color: #ef4444;
    border: 1px solid #fee2e2;
    padding: 0.75rem;
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
}

.alert-success {
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid #dcfce7;
    padding: 0.75rem;
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
}

/* Estimation Module View Panels */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.page-title-group {
    display: flex;
    flex-content: column;
}

.page-subtitle {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
}

.est-card {
    background-color: #ffffff;
    padding: 1.25rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

.est-card-title {
    font-size: 0.875rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
}

.est-table-wrapper {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 2px;
}

.est-table {
    min-w: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
}

.est-table th {
    padding: 0.5rem 0.75rem;
    background-color: #f1f5f9;
    text-align: left;
    font-size: 10px;
    font-weight: 800;
    color: #475569;
    letter-spacing: 0.05em;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.est-table td {
    padding: 0.5rem 0.75rem;
    white-space: nowrap;
    font-size: 11px;
    color: #374151;
    font-weight: 500;
    border: 1px solid #e2e8f0;
}

.est-table .sticky-col {
    position: sticky;
    left: 0;
    background-color: #ffffff;
    border-right: 2px solid #e2e8f0;
    z-index: 20;
}

.est-table th.sticky-col {
    background-color: #f1f5f9;
    z-index: 30;
}

.est-table .sub-header td {
    background-color: #e2e8f0;
    color: #0f172a;
    font-weight: 700;
    font-size: 11px;
    text-align: left;
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
}

.est-table .total-row td {
    background-color: #f8fafc;
    font-weight: 700;
    border-top: 2px solid #94a3b8;
}

.est-input {
    display: block;
    width: 100%;
    text-align: center;
    border: none;
    background-color: transparent;
    padding: 0.25rem 0.5rem;
    font-size: 11px;
}

.est-input:focus {
    outline: none;
    border-radius: 2px;
    box-shadow: 0 0 0 2px #64748b;
    background-color: #ffffff;
}

.btn-add-block {
    width: 100%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 1rem;
    border: 2px dashed #d1d5db;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 2px;
    color: #4b5563;
    background-color: #f9fafb;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-add-block:hover {
    background-color: #f3f4f6;
    border-color: #64748b;
    color: #0f172a;
}

.btn-remove {
    color: #9ca3af;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s ease;
}

.btn-remove:hover {
    color: #ef4444;
}

/* Pile Dynamic Data Matrix Render Struct Overrides */
#pileTable th {
    vertical-align: middle !important;
    text-align: center !important;
    padding: 4px 8px !important; 
    line-height: 1.1 !important;
    font-size: 0.8rem;
}

#pileTable th.sticky-col {
    text-align: left !important;
}

#pileTable td {
    padding: 0 !important;
    vertical-align: middle !important;
    border: 1px solid #e2e8f0; 
}

#pileTable .est-input {
    height: 26px !important;
    min-height: 26px !important;
    padding: 0 4px !important;
    font-size: 0.7rem !important;
    border-radius: 0 !important;
    border: none !important;
    width: 100%;
    text-align: center;
}

#pileTable td.sticky-col .est-input {
    text-align: left;
    padding-left: 8px !important;
}

/* ==========================================
   TRUE MOBILE RESPONSIVE TABLES (Card View)
   ========================================== */
@media (max-width: 768px) {
    /* Remove the wrapper border on mobile so cards float freely */
    .data-table-wrapper {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    /* Hide standard table headers */
    .data-table thead {
        display: none;
    }

    /* Convert table elements to block to stack them vertically */
    .data-table, 
    .data-table tbody, 
    .data-table tr, 
    .data-table td {
        display: block;
        width: 100%;
    }

    /* Style each row as a standalone card */
    .data-table tr {
        margin-bottom: 1rem;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        background-color: #ffffff;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }

    /* Style each cell to look like a key-value pair */
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #f1f5f9;
        text-align: right;
    }

    /* Remove border from the last item (Actions) */
    .data-table td:last-child {
        border-bottom: none;
    }

    /* Inject the column header text using the data-label attribute */
    .data-table td::before {
        content: attr(data-label);
        font-weight: 800;
        color: #64748b;
        text-transform: uppercase;
        font-size: 0.65rem;
        letter-spacing: 0.05em;
        margin-right: 1rem;
        text-align: left;
    }

    /* Ensure action buttons wrap neatly if screen is very small */
    .data-table td[data-label="Actions"] {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.5rem;
    }
    
    .data-table td[data-label="Actions"] .d-inline-flex {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

/* File: /assets/css/custom-takeoff.css */

/* =========================================================================
   1. SPREADSHEET / EDITORIAL DESIGN RESTORATION
   ========================================================================= */
.custom-compact-table {
    border-collapse: collapse;
    width: 100%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    margin-bottom: 0;
}

/* Force override Bootstrap's bloated padding to restore 24px tight rows */
.custom-compact-table th,
.custom-compact-table td {
    height: 24px !important;
    min-height: 24px !important;
    padding: 6px 8px !important;
    vertical-align: middle !important;
    border: 1px solid #e2e8f0 !important;
}

.custom-compact-table th {
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #64748b !important;
    text-transform: uppercase;
    background: #f8fafc !important;
    letter-spacing: 0.05em;
}

.custom-compact-table td {
    font-size: 11px !important;
    color: #334155;
}

/* Alignment Utilities */
.metric-col { width: 14%; text-align: center !important; }
.action-col { width: 80px; text-align: center !important; }
.name-col { width: 34%; text-align: left !important; }

/* Category & Total Rows specific coloring */
.custom-compact-table tr.cat-group td {
    background-color: #e2e8f0 !important;
    color: #1e293b !important;
    font-weight: bold;
    text-align: left !important;
    border-top: 2px solid #cbd5e1 !important;
}

.subtotal-row td { background-color: #eef2ff !important; border-bottom: 2px solid #c7d2fe !important; }
.grandtotal-row td { background-color: #dbeafe !important; border-bottom: 2px solid #93c5fd !important; }

/* Sub-category Header (Detailed Mode) */
.sub-cat-header td {
    background-color: #f8fafc !important;
    font-weight: 700 !important;
    color: #475569 !important;
    text-align: left !important;
    padding-left: 20px !important;
}

/* =========================================================================
   2. TRUE MOBILE SPREADSHEET VIEW (Sticky First Column)
   ========================================================================= */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e5e7eb;
    border-radius: 2px;
}

/* Make the first column stick to the left when scrolling horizontally */
.custom-compact-table .sticky-col-first {
    position: sticky;
    left: 0;
    background-color: #ffffff !important;
    z-index: 2;
    /* Add a subtle shadow to indicate scrollable content underneath */
    box-shadow: 2px 0 4px -2px rgba(0,0,0,0.1); 
}

/* Ensure the header of the sticky column stays on top */
.custom-compact-table th.sticky-col-first {
    background-color: #f8fafc !important;
    z-index: 3;
}

/* For Category rows that span all columns, keep them above the sticky shadow */
.custom-compact-table tr.cat-group td.sticky-col-first {
    background-color: #e2e8f0 !important;
    z-index: 3;
}

/* ==========================================================================
   MINIMAL COMPACT CONTROLS & TABLE INPUTS
   ========================================================================== */

/* Typography Helpers */
.fs-7 { font-size: 0.8rem; }
.w-30px { width: 30px; min-width: 30px; }
.w-50px { width: 50px; min-width: 50px; }
.w-120px { width: 120px; min-width: 120px; }
.border-blue-100 { border-color: #dbeafe !important; }
.border-orange-100 { border-color: #ffedd5 !important; }
.border-green-100 { border-color: #dcfce3 !important; }

/* Global Minimal Input Bar */
.compact-form-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.compact-control-input {
    height: 24px;
    font-size: 0.75rem;
    padding: 0 4px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    outline: none;
    box-shadow: none;
    background-color: #ffffff;
}
.compact-control-input:focus {
    border-color: #3b82f6;
}

.compact-btn {
    height: 24px;
    padding: 0 10px;
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 3px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    text-transform: uppercase;
}

/* Bare Minimum Table Cell Inputs (No Bootstrap bloat) */
.table-cell-input {
    width: 100%;
    height: 24px; /* Matches custom-compact-table row height */
    border: none;
    background: transparent;
    text-align: center;
    font-weight: 700;
    font-size: 11px; /* Uniform minimal text size */
    color: #334155;
    outline: none;
    padding: 0;
    margin: 0;
    box-shadow: none !important;
    transition: background-color 0.2s;
}

.table-cell-input:focus {
    background-color: #ffffff;
    box-shadow: inset 0 0 0 1px #3b82f6 !important; /* Inner highlight only */
}

/* Hide Spinners completely on cell inputs */
.table-cell-input[type=number]::-webkit-inner-spin-button,
.table-cell-input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.table-cell-input[type=number] {
    -moz-appearance: textfield;
}

/* Minimal Recycle Bin Icon (No borders, transparent bg) */
.btn-delete-icon {
    background: transparent;
    border: none;
    color: #ef4444; /* text-danger */
    font-size: 11px;
    padding: 4px;
    margin: 0;
    cursor: pointer;
    box-shadow: none;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: transform 0.15s ease, color 0.15s ease;
}
.btn-delete-icon:hover {
    color: #b91c1c;
    transform: scale(1.15);
}

/* Mobile Adjustments for minimal inputs */
@media (max-width: 767.98px) {
    .table-cell-input {
        text-align: right;
        min-width: 100px;
        padding-right: 0.5rem;
    }
    .table-cell-input.text-start {
        text-align: right !important; /* Force right alignment on mobile cards */
    }
}