/* ==========================================================================
   Todomat Stock Manager - Portal Styles (Premium Glassmorphism & Animations)
   ========================================================================== */

/* Wrapper principal y Contenedor de Flex */
.todomat-portal-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
    padding: 20px 0;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

/* Tarjeta Principal Glassmorphism */
.todomat-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 
                0 1px 3px rgba(0, 0, 0, 0.02),
                inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.todomat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.12), 
                0 1px 3px rgba(0, 0, 0, 0.02);
}

/* Header del Portal */
.todomat-card-header {
    text-align: center;
    margin-bottom: 30px;
}

.portal-logo {
    font-size: 32px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -1px;
    margin-bottom: 12px;
}

.portal-logo span {
    color: #0284c7;
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.todomat-card-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.todomat-card-header p {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
}

/* Formulario */
.portal-form .form-group {
    margin-bottom: 20px;
}

.portal-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.portal-form input[type="text"],
.portal-form input[type="email"],
.portal-form input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    font-family: inherit;
    color: #0f172a;
    background: rgba(255, 255, 255, 0.8);
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.25s ease;
    box-sizing: border-box;
    box-shadow: 0 2px 4px rgba(0,0,0,0.01) inset;
}

.portal-form input[type="text"]:focus,
.portal-form input[type="email"]:focus,
.portal-form input[type="password"]:focus {
    outline: none;
    border-color: #0284c7;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.12),
                0 4px 10px rgba(2, 132, 199, 0.05);
}

.portal-form input::placeholder {
    color: rgba(15, 23, 42, 0.35);
    opacity: 1;
}

.portal-form input:focus::placeholder {
    color: transparent !important;
}

/* Recordar y Acciones */
.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.remember-me {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.remember-me input {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    accent-color: #0284c7;
}

.remember-me span {
    font-size: 14px;
    color: #475569;
}

/* Botones */
.portal-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
    transition: all 0.25s ease;
}

.portal-btn:hover {
    background: linear-gradient(135deg, #38bdf8 0%, #0369a1 100%);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.35);
    transform: translateY(-1px);
}

.portal-btn:active {
    transform: translateY(1px);
}

/* Alertas */
.portal-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.4;
}

.error-alert {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.success-alert {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.portal-alert p {
    margin: 0;
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   Buscador Interface
   -------------------------------------------------------------------------- */
.search-card {
    max-width: 600px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    padding-bottom: 15px;
}

.logout-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #ef4444;
    text-decoration: none;
    padding: 6px 12px;
    background: #fef2f2;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.logout-link:hover {
    background: #fee2e2;
    transform: translateX(2px);
}

/* Buscador Input Caja */
.portal-search-box {
    margin-bottom: 30px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.01) inset;
    transition: all 0.25s ease;
    padding: 0;
    overflow: hidden;
}

.search-input-wrapper:focus-within {
    border-color: #0284c7;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.12),
                0 4px 12px rgba(2, 132, 199, 0.05);
}

.search-input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 14px 20px;
    font-size: 16px;
    font-family: inherit;
    color: #0f172a;
    width: 100%;
}

.search-input-wrapper input:focus {
    outline: none;
}

.search-btn {
    background: #0284c7;
    border: none;
    color: white;
    width: 56px;
    align-self: stretch;
    height: auto;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

.search-btn:hover {
    background: #0369a1;
}

.search-btn svg {
    width: 24px !important;
    height: 24px !important;
    stroke-width: 3px !important;
    display: block;
    margin: 0 auto;
}

/* Contenedor de Resultados AJAX */
.search-result-container {
    min-height: 0;
    transition: all 0.3s ease;
}

/* Tarjeta de Producto Encontrado */
.product-result-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-info-header {
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
}

.sku-tag {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.product-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    line-height: 1.4;
}

/* Badge de Stock */
.stock-status-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafafa;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
}

.stock-label {
    font-size: 14px;
    color: #475569;
    font-weight: 500;
}

.stock-value {
    font-size: 20px;
    font-weight: 700;
}

/* Clases de Estado de Stock */
.status-available {
    color: #15803d;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
}

.status-out-of-stock {
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
}

.update-date {
    font-size: 12px;
    color: #94a3b8;
    text-align: right;
    margin-top: 8px;
}

/* Spinner de carga */
.portal-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
    gap: 15px;
}

.spinner-ring {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(2, 132, 199, 0.1);
    border-top: 4px solid #0284c7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.portal-spinner p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
    font-weight: 500;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.animate-fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
