/**
 * Form Components Stylesheet
 * 
 * Optimized styles for icon-input and password-input Blade components
 * with full accessibility support, focus states, and responsive behavior.
 * 
 * @package eduSYMS
 * @version 1.0.0
 */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    /* Spacing */
    --form-input-padding-y: 0.625rem;         /* 10px */
    --form-input-padding-x: 0.75rem;          /* 12px */
    --form-input-padding-left-icon: 2.75rem;  /* 44px */
    --form-input-padding-right-action: 2.75rem; /* 44px */
    --form-input-padding-sm-y: 0.5rem;        /* 8px */
    --form-input-padding-sm-x: 0.625rem;      /* 10px */
    --form-input-padding-sm-left-icon: 2.25rem; /* 36px */
    --form-input-padding-sm-right-action: 2.25rem; /* 36px */
    
    /* Icons */
    --form-icon-size: 1rem;                   /* 16px */
    --form-icon-left: 0.75rem;                /* 12px */
    --form-icon-right: 0.75rem;               /* 12px */
    --form-icon-sm-size: 0.875rem;            /* 14px */
    --form-icon-sm-left: 0.625rem;            /* 10px */
    --form-icon-sm-right: 0.625rem;           /* 10px */
    
    /* Focus Ring */
    --form-focus-ring-width: 3px;
    --form-focus-ring-color: rgba(147, 195, 59, 0.15);
    --form-focus-border-color: #93c33b;
    --form-focus-ring-error: rgba(239, 68, 68, 0.15);
    
    /* States */
    --form-input-disabled-opacity: 0.6;
    --form-error-color: #ef4444;
    --form-success-color: #10b981;
    
    /* Heights */
    --form-input-height: 2.75rem;             /* 44px */
    --form-input-height-sm: 2.25rem;          /* 36px */
}

/* ============================================
   FORM GROUP & SPACING
   ============================================ */
.form-group {
    margin-bottom: 1rem;
    width: 100%;
}

.form-group:last-child {
    margin-bottom: 0;
}

/* ============================================
   LABELS
   ============================================ */
.form-label {
    display: block;
    font-weight: 500;
    color: var(--gray-800, #1f2937);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.form-label .text-danger {
    color: var(--form-error-color);
    margin-left: 0.125rem;
}

/* ============================================
   INPUT CONTAINER
   ============================================ */
.input-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* ============================================
   INPUT FIELDS - BASE STYLES
   ============================================ */
.form-input {
    width: 100%;
    height: var(--form-input-height);
    padding: var(--form-input-padding-y) var(--form-input-padding-x);
    border: 2px solid var(--gray-200, #e5e7eb);
    border-radius: var(--radius-md, 0.5rem);
    background: var(--white, #ffffff);
    font-size: 0.9375rem;
    line-height: 1.5;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--gray-800, #1f2937);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Placeholder */
.form-input::placeholder {
    color: var(--gray-500, #6b7280);
    opacity: 1;
}

.form-input::-webkit-input-placeholder {
    color: var(--gray-500, #6b7280);
    opacity: 1;
}

.form-input::-moz-placeholder {
    color: var(--gray-500, #6b7280);
    opacity: 1;
}

/* ============================================
   INPUT FIELDS - WITH ICONS
   ============================================ */
.form-input.has-left-icon {
    padding-left: var(--form-input-padding-left-icon);
}

.form-input.has-right-action {
    padding-right: var(--form-input-padding-right-action);
}

/* ============================================
   INPUT FIELDS - FOCUS STATES
   ============================================ */
/* Focus-visible (keyboard navigation only) */
.form-input:focus-visible {
    outline: none;
    border-color: var(--form-focus-border-color);
    box-shadow: 0 0 0 var(--form-focus-ring-width) var(--form-focus-ring-color);
}

/* Fallback for browsers without focus-visible support */
.form-input:focus {
    outline: none;
    border-color: var(--form-focus-border-color);
    box-shadow: 0 0 0 var(--form-focus-ring-width) var(--form-focus-ring-color);
}

/* Remove focus ring on mouse click (for browsers supporting focus-visible) */
.form-input:focus:not(:focus-visible) {
    box-shadow: none;
    border-color: var(--gray-200, #e5e7eb);
}

/* ============================================
   INPUT FIELDS - ERROR STATE
   ============================================ */
.form-input.error {
    border-color: var(--form-error-color);
}

.form-input.error:focus,
.form-input.error:focus-visible {
    border-color: var(--form-error-color);
    box-shadow: 0 0 0 var(--form-focus-ring-width) var(--form-focus-ring-error);
}

/* ============================================
   INPUT FIELDS - DISABLED STATE
   ============================================ */
.form-input:disabled {
    opacity: var(--form-input-disabled-opacity);
    cursor: not-allowed;
    background: var(--gray-100, #f3f4f6);
}

/* ============================================
   INPUT FIELDS - SIZE VARIANTS
   ============================================ */
.form-input.size-sm {
    height: var(--form-input-height-sm);
    padding: var(--form-input-padding-sm-y) var(--form-input-padding-sm-x);
    font-size: 0.875rem;
}

.form-input.size-sm.has-left-icon {
    padding-left: var(--form-input-padding-sm-left-icon);
}

.form-input.size-sm.has-right-action {
    padding-right: var(--form-input-padding-sm-right-action);
}

/* ============================================
   ICONS - LEFT (DECORATIVE)
   ============================================ */
.input-icon {
    position: absolute;
    left: var(--form-icon-left);
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500, #6b7280);
    font-size: var(--form-icon-size);
    pointer-events: none;
    transition: color 0.2s ease;
    z-index: 1;
}

/* Icon color change on focus */
.input-container:focus-within .input-icon {
    color: var(--form-focus-border-color);
}

/* Icon in error state */
.form-input.error ~ .input-icon {
    color: var(--form-error-color);
}

/* Small variant */
.size-sm ~ .input-icon,
.form-input.size-sm ~ .input-icon {
    font-size: var(--form-icon-sm-size);
    left: var(--form-icon-sm-left);
}

/* ============================================
   ACTION BUTTONS - RIGHT (INTERACTIVE)
   ============================================ */
.input-action-btn,
.password-toggle {
    position: absolute;
    right: var(--form-icon-right);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-500, #6b7280);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm, 0.375rem);
    transition: color 0.2s ease, background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    min-width: 2.5rem;
    min-height: 2.5rem;
}

.input-action-btn:hover,
.password-toggle:hover {
    color: var(--form-focus-border-color);
    background: var(--gray-100, #f3f4f6);
}

.input-action-btn:focus-visible,
.password-toggle:focus-visible {
    outline: 2px solid var(--form-focus-border-color);
    outline-offset: 2px;
    color: var(--form-focus-border-color);
}

.input-action-btn:active,
.password-toggle:active {
    background: var(--gray-200, #e5e7eb);
}

/* Disabled state */
.input-action-btn:disabled,
.password-toggle:disabled {
    opacity: var(--form-input-disabled-opacity);
    cursor: not-allowed;
}

/* Small variant */
.size-sm ~ .input-action-btn,
.size-sm ~ .password-toggle {
    right: var(--form-icon-sm-right);
    min-width: 2rem;
    min-height: 2rem;
    padding: 0.375rem;
}

/* ============================================
   ERROR MESSAGES
   ============================================ */
.error-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--form-error-color);
    font-size: 0.875rem;
    line-height: 1.25rem;
    margin-top: 0.5rem;
}

.error-message i {
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* ============================================
   HELP TEXT / HINTS
   ============================================ */
.input-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600, #4b5563);
    font-size: 0.875rem;
    line-height: 1.25rem;
    margin-top: 0.5rem;
}

.input-hint i {
    font-size: 0.75rem;
    color: var(--gray-500, #6b7280);
    flex-shrink: 0;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 640px) {
    .form-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .form-input.size-sm {
        font-size: 14px;
    }
}

/* ============================================
   HIGH CONTRAST MODE SUPPORT
   ============================================ */
@media (prefers-contrast: high) {
    .form-input {
        border-width: 2px;
    }
    
    .form-input:focus-visible {
        outline: 3px solid;
        outline-offset: 2px;
    }
    
    .input-action-btn:focus-visible,
    .password-toggle:focus-visible {
        outline-width: 3px;
    }
}

/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .form-input,
    .input-icon,
    .input-action-btn,
    .password-toggle {
        transition: none;
    }
}

/* ============================================
   DARK MODE SUPPORT (Optional - Uncomment if needed)
   ============================================ */
/*
@media (prefers-color-scheme: dark) {
    .form-input {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .form-input::placeholder {
        color: #9ca3af;
    }
    
    .form-label {
        color: #f9fafb;
    }
    
    .input-icon {
        color: #9ca3af;
    }
    
    .input-action-btn,
    .password-toggle {
        color: #9ca3af;
    }
    
    .input-action-btn:hover,
    .password-toggle:hover {
        background: #374151;
    }
    
    .form-input:disabled {
        background: #374151;
    }
}
*/
