/**
 * Industrial Tagz — UI component styles
 *
 * Companion stylesheet for public/js/ui.js.
 * Provides styles for:
 *   1. Loading overlay (spinner)
 *   2. Toast notification system
 *   3. iOS input zoom prevention
 *   4. Touch target sizing
 */

/* ── Loading Overlay ─────────────────────────────────────────── */

#itz-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

#itz-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.itz-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #334155; /* slate-700 */
}

.itz-loading-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #64748b; /* slate-500 */
    letter-spacing: 0.02em;
}


/* ── Toast Container ─────────────────────────────────────────── */

#itz-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 22rem;
    max-width: calc(100vw - 2rem);
    pointer-events: none;
}


/* ── Individual Toast ────────────────────────────────────────── */

.itz-toast {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1),
                0 4px 6px -2px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    pointer-events: auto;
    transform: translateX(110%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.4s ease;
}

.itz-toast--visible {
    transform: translateX(0);
    opacity: 1;
}

.itz-toast--exit {
    transform: translateX(110%);
    opacity: 0;
    transition: transform 0.3s ease-in,
                opacity 0.3s ease-in;
}


/* ── Toast Body ──────────────────────────────────────────────── */

.itz-toast-body {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
}

.itz-toast-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.itz-toast--success .itz-toast-icon { color: #10b981; }
.itz-toast--error   .itz-toast-icon { color: #ef4444; }
.itz-toast--info    .itz-toast-icon { color: #3b82f6; }

.itz-toast-message {
    flex: 1;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.875rem;
    line-height: 1.4;
    color: #374151;
}


/* ── Toast Close Button ──────────────────────────────────────── */

.itz-toast-close {
    position: relative;
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    color: #9ca3af;
    border-radius: 0.25rem;
    transition: color 0.15s ease, background-color 0.15s ease;
}

/* Expanded touch target via pseudo-element (44px minimum) */
.itz-toast-close::before {
    content: '';
    position: absolute;
    inset: -10px;
}

.itz-toast-close:hover {
    color: #4b5563;
    background-color: #f3f4f6;
}

.itz-toast-close svg {
    width: 0.875rem;
    height: 0.875rem;
}


/* ── Toast Progress Bar ──────────────────────────────────────── */

.itz-toast-progress {
    height: 3px;
    width: 100%;
    border-radius: 0 0 0.75rem 0.75rem;
}


/* ── iOS Input Zoom Prevention ───────────────────────────────── */

@supports (-webkit-touch-callout: none) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    input[type="search"],
    input[type="date"],
    input[type="datetime-local"],
    input[type="time"],
    select,
    textarea {
        font-size: 16px !important;
    }
}


/* ── Touch Target Sizing ─────────────────────────────────────── */

@media (pointer: coarse) {
    /* Buttons and links in navigation/actions */
    .touch-target {
        min-height: 44px;
        min-width: 44px;
    }

    /* Ensure form elements have adequate size */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    input[type="search"],
    input[type="date"],
    input[type="datetime-local"],
    input[type="time"],
    select,
    textarea {
        min-height: 44px;
    }

    input[type="checkbox"],
    input[type="radio"] {
        min-width: 20px;
        min-height: 20px;
    }

    /* Table action buttons */
    table .btn,
    table a[href] {
        min-height: 36px;
        padding-top: 0.375rem;
        padding-bottom: 0.375rem;
    }
}
