/* =============================================================
   Inoquos shared components
   -------------------------------------------------------------
   Unprefixed .ino-* component classes for any page that includes
   shared/_ino_head.html. Designed for use in:
     - New pages
     - Pages migrated off legacy inline styles
     - Customer-facing forms

   Existing dashboards (warehouse, quality, HR, employee) keep
   their prefix classes (.wd-, .qd-, .hr-) — they already
   converge through the design tokens.
   ============================================================= */

* { box-sizing: border-box; }

/* ── Layout ─────────────────────────────────────────────── */
.ino-container        { max-width: var(--ino-container-narrow); margin: 0 auto; padding: 0 16px; }
.ino-container-wide   { max-width: var(--ino-container-wide);   margin: 0 auto; padding: 0 16px; }

/* ── Cards ──────────────────────────────────────────────── */
.ino-card {
    background: var(--ino-surface);
    border: 1px solid var(--ino-border);
    border-radius: var(--ino-card-radius);
    padding: 20px;
    margin-bottom: 16px;
}
.ino-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.ino-card-title { font-size: 16px; font-weight: 600; margin: 0; color: var(--ino-text); }

/* ── Forms ──────────────────────────────────────────────── */
.ino-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}
.ino-form-group label {
    font-size: var(--ino-label-size);
    font-weight: 500;
    color: var(--ino-text-muted);
}
.ino-form-group input,
.ino-form-group select,
.ino-form-group textarea {
    padding: var(--ino-input-padding);
    border: 1px solid var(--ino-border);
    border-radius: var(--ino-input-radius);
    font-size: var(--ino-input-size);
    font-family: inherit;
    background: var(--ino-surface);
    color: var(--ino-text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}
.ino-form-group input:focus,
.ino-form-group select:focus,
.ino-form-group textarea:focus {
    border-color: var(--ino-accent);
    box-shadow: var(--ino-focus-ring);
}
.ino-form-group textarea { resize: vertical; min-height: 60px; }
.ino-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.ino-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.ino-error-text {
    color: var(--ino-danger);
    font-size: 13px;
    margin-top: 4px;
}

/* ── Buttons ────────────────────────────────────────────── */
.ino-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 20px;
    border: 1px solid transparent;
    border-radius: var(--ino-input-radius);
    font-size: var(--ino-input-size);
    font-family: inherit;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.ino-btn:focus-visible { outline: none; box-shadow: var(--ino-focus-ring); }
.ino-btn:disabled       { opacity: 0.5; cursor: not-allowed; }
.ino-btn-primary        { background: var(--ino-accent); color: var(--ino-text-inverse); }
.ino-btn-primary:hover  { background: var(--ino-accent-hover); }
.ino-btn-success        { background: var(--ino-success); color: var(--ino-text-inverse); }
.ino-btn-success:hover  { opacity: 0.9; }
.ino-btn-danger         { background: var(--ino-danger);  color: var(--ino-text-inverse); }
.ino-btn-danger:hover   { opacity: 0.9; }
.ino-btn-outline        { background: transparent; border-color: var(--ino-border); color: var(--ino-text); }
.ino-btn-outline:hover  { background: var(--ino-surface-alt); }
.ino-btn-ghost          { background: transparent; color: var(--ino-text-muted); padding: 6px 10px; }
.ino-btn-ghost:hover    { background: var(--ino-surface-alt); color: var(--ino-text); }
.ino-btn-sm             { padding: 4px 12px; font-size: 13px; }
.ino-btn-lg             { padding: 12px 24px; font-size: 15px; min-height: 48px; }
.ino-btn-block          { width: 100%; }
.ino-btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Tables ─────────────────────────────────────────────── */
.ino-table-wrap { overflow-x: auto; }
.ino-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    color: var(--ino-text);
    background: var(--ino-surface);
}
.ino-table th {
    text-align: left;
    padding: 10px 14px;
    background: var(--ino-surface-alt);
    border-bottom: 1px solid var(--ino-border);
    font-weight: 600;
    font-size: 12px;
    color: var(--ino-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.ino-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--ino-border);
    vertical-align: middle;
}
.ino-table tbody tr:hover { background: var(--ino-surface-alt); }

/* ── Empty states ───────────────────────────────────────── */
.ino-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--ino-text-muted);
}
.ino-empty-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    opacity: 0.6;
}
.ino-empty-title  { font-size: 15px; font-weight: 600; color: var(--ino-text); margin: 0 0 4px; }
.ino-empty-desc   { font-size: 13px; margin: 0 0 12px; }
.ino-empty-action { margin-top: 8px; }

/* ── Status badges / pills ─────────────────────────────── */
.ino-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.4;
}
.ino-badge-neutral { background: var(--ino-surface-alt); color: var(--ino-text-muted); }
.ino-badge-info    { background: var(--ino-info-soft);    color: var(--ino-info); }
.ino-badge-success { background: var(--ino-success-soft); color: var(--ino-success); }
.ino-badge-warning { background: var(--ino-warning-soft); color: var(--ino-warning); }
.ino-badge-danger  { background: var(--ino-danger-soft);  color: var(--ino-danger); }
.ino-badge-accent  { background: var(--ino-accent-soft);  color: var(--ino-accent); }

/* ── Toasts (flash messages) ────────────────────────────── */
.ino-toast-container {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--ino-z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: calc(100% - 32px);
    max-width: 400px;
}
.ino-toast {
    pointer-events: auto;
    padding: 12px 16px;
    border-radius: var(--ino-input-radius);
    color: var(--ino-text-inverse);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--ino-shadow-md);
    animation: ino-toast-in 0.25s ease-out;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ino-toast-out     { animation: ino-toast-out 0.2s ease-in forwards; }
.ino-toast-success { background: var(--ino-success); }
.ino-toast-error   { background: var(--ino-danger); }
.ino-toast-warning { background: var(--ino-warning); }
.ino-toast-info    { background: var(--ino-accent); }

@keyframes ino-toast-in  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes ino-toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }

/* ── Modal / overlay ────────────────────────────────────── */
.ino-modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--ino-overlay-bg);
    z-index: var(--ino-z-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.ino-modal-panel {
    background: var(--ino-surface);
    border-radius: var(--ino-card-radius);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--ino-shadow-lg);
}
.ino-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ino-border);
}
.ino-modal-title { font-size: 16px; font-weight: 600; margin: 0; }
.ino-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--ino-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
}
.ino-modal-close:hover { background: var(--ino-surface-alt); }
.ino-modal-body   { padding: 20px; overflow-y: auto; flex: 1; }
.ino-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--ino-border);
}

/* ── Loading / skeleton ─────────────────────────────────── */
.ino-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--ino-border);
    border-top-color: var(--ino-accent);
    border-radius: 50%;
    animation: ino-spin 0.6s linear infinite;
}
.ino-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px;
    color: var(--ino-text-muted);
    font-size: 14px;
}
@keyframes ino-spin { to { transform: rotate(360deg); } }

.ino-skeleton {
    background: linear-gradient(90deg,
        var(--ino-surface-alt) 0%,
        var(--ino-border) 50%,
        var(--ino-surface-alt) 100%);
    background-size: 200% 100%;
    border-radius: var(--ino-input-radius);
    animation: ino-skeleton-pulse 1.4s ease-in-out infinite;
    color: transparent;
    user-select: none;
}
.ino-skeleton-text  { height: 1em; margin: 4px 0; }
.ino-skeleton-line  { height: 14px; margin-bottom: 8px; }
.ino-skeleton-block { height: 80px; }
@keyframes ino-skeleton-pulse {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ── Icons ──────────────────────────────────────────────── */
.ino-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    line-height: 0;
}
.ino-icon-sm { width: 16px; height: 16px; }
.ino-icon-lg { width: 24px; height: 24px; }

/* ── Utility ────────────────────────────────────────────── */
.ino-muted     { color: var(--ino-text-muted); }
.ino-mono      { font-family: 'SF Mono', 'Menlo', 'Consolas', monospace; }
.ino-text-sm   { font-size: 13px; }
.ino-text-xs   { font-size: 12px; }
.ino-hidden    { display: none !important; }
.ino-stack     { display: flex; flex-direction: column; gap: 12px; }
.ino-row       { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ino-row-end   { justify-content: flex-end; }
.ino-row-between { justify-content: space-between; }
