/* Ensure the card is opaque and sits on top */
.huchi-confirm-card {
    background-color: #ffffff !important; 
    opacity: 1 !important;
    z-index: 10001; /* Higher than the backdrop */
    border: 1px solid #dee2e6;
    min-width: 350px;
}

/* Fix the backdrop positioning */
.huchi-confirm-overlay.modal-backdrop {
    opacity: 1 !important; /* Ensure the darkening is visible */
    background-color: rgba(0, 0, 0, 0.5) !important;
}

/* Icon Fix: Ensure the icon has a color if FA6 is acting up */
.huchi-confirm-card i {
    font-style: normal;
    color: inherit; /* Inherits from your text-danger/text-warning classes */
}

.huchi-flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.huchi-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

/* 2. Inputs & Forms */
.huchi-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background-color: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.huchi-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.huchi-input-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* 3. Buttons */
.huchi-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.huchi-btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.huchi-btn-primary { background: #2563eb; color: #fff; }
.huchi-btn-primary:hover { background: #1d4ed8; }

.huchi-btn-danger { background: #dc2626; color: #fff; }
.huchi-btn-danger:hover { background: #b91c1c; }

.huchi-btn-warning { background: #f59e0b; color: #fff; }
.huchi-btn-warning:hover { background: #d97706; }

.huchi-btn-light { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.huchi-btn-light:hover { background: #e5e7eb; }

.huchi-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 4. Processing & System UI */
body.huchi-processing {
    pointer-events: none;
    cursor: wait;
}

body.huchi-processing::after {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(255, 255, 255, 0.4);
    z-index: 9999;
}

#huchi-system-tray {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 9999;
    width: 300px;
    pointer-events: none;
}

.huchi-toast {
    background: white;
    border: 1px solid #ddd;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 4px;
    pointer-events: auto;
}

/* 5. Animations */
@keyframes huchiFadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.95); }
}
.huchi-fade-out { animation: huchiFadeOut 0.25s forwards; pointer-events: none; }

@keyframes huchiOverlayFade {
    from { background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(4px); }
    to { background: rgba(0, 0, 0, 0); backdrop-filter: blur(0px); }
}
.huchi-overlay-fade-out { animation: huchiOverlayFade 0.3s forwards; }
/* 6. Data Tables (Huchi Vanilla) */
.huchi-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    background-color: #fff;
    font-size: 0.95rem;
}

.huchi-table th {
    background-color: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    padding: 0.75rem;
    text-align: left;
    font-weight: 700;
    color: #374151;
}

.huchi-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.huchi-table-hover tbody tr:hover {
    background-color: #f9fafb;
}

.huchi-table-striped tbody tr:nth-of-type(odd) {
    background-color: #fafafa;
}

/* Grid Row States */
.huchi-row-danger  { background-color: #fef2f2; color: #991b1b; }
.huchi-row-success { background-color: #f0fdf4; color: #166534; }
.huchi-row-warning { background-color: #fffbeb; color: #92400e; }

/* --- Huchi Grid Core Table Styles --- */
.huchi-grid {
    background-color: #F9F9F9 !important;
    border-top: 0.3em solid #6c757d; /* Gray accent from inline style */
    font-size: 12px;
    width: 100%;
    border-collapse: collapse;
}

.huchi-grid thead {
    position: sticky;
    top: 0;
    background-color: #ffffff;
    z-index: 10;
    border-bottom: 2px solid #DDDDDD;
}

.huchi-grid th {
    white-space: nowrap;
    vertical-align: middle;
}

.huchi-grid tbody tr {
    transition: background-color 0.15s ease-in-out;
    cursor: context-menu; /* Indicates right-click availability */
}

/* Hover effect previously handled by Bootstrap but reinforced here */
.huchi-grid.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05) !important;
}

/* --- Dynamic Context Menu Styles --- */
#grid-dynamic-menu {
    min-width: 180px;
    padding: 5px 0;
    margin: 0;
    font-size: 13px;
    background-color: #ffffff;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175) !important;
    display: none; /* Controlled by JS */
}

#grid-dynamic-menu .dropdown-item {
    padding: 8px 15px;
    color: #333;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

#grid-dynamic-menu .dropdown-item:hover {
    background-color: #f8f9fa;
    color: #000;
}

#grid-dynamic-menu .dropdown-item i {
    width: 20px;
    text-align: center;
    font-size: 14px;
}

#grid-dynamic-menu .dropdown-divider {
    margin: 4px 0;
}

/* --- Grid Component Wrapper Styles --- */
.grid-wrapper .card {
    border-radius: 8px;
    overflow: hidden;
}

.grid-wrapper .card-header {
    background-color: #fff;
    border-bottom: 1px solid #eee;
    padding: 1rem;
}

/* Utility for text truncation (the 'wrapper' method logic) */
.huchi-grid td span[data-toggle="tooltip"] {
    display: inline-block;
    max-width: 100%;
    cursor: help;
    border-bottom: 1px dotted #ccc;
}

/* Responsive container overrides */
.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: #ccc #f9f9f9;
}

/* Target the table cells specifically */
.huchi-grid td {
    font-size: 11px;           /* Reduced from 12px */
    padding: 4px 8px;         /* Tightens the vertical spacing */
    vertical-align: middle;
    line-height: 1.2;
    color: #444;              /* Softens the black for better readability */
    white-space: nowrap;      /* Prevents text wrapping which causes large row heights */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ensure headers match the scale */
.huchi-grid th {
    font-size: 11px;
    font-weight: 600;
    padding: 8px;
    text-transform: uppercase; /* Optional: makes small headers clearer */
    letter-spacing: 0.02em;
}

/* If you have input elements inside TDs (like in DataInput or Grid) */
.huchi-grid td input, 
.huchi-grid td select {
    font-size: 11px !important;
    height: calc(1.5em + 0.5rem + 2px); /* Makes form elements fit the row */
    padding: 2px 5px;
}
/**
 * .huchi-hide
 * Forces an element to be hidden regardless of other utility classes.
 * Similar to Bootstrap's .d-none or Tailwind's .hidden
 */
.huchi-hide {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}