/**
 * SECURE LOGIN SYSTEM - RESPONSIVE STYLESHEET
 * Mobile-first design approach
 * Responsive for smartphones, tablets, and desktop screens
 */

/* ============================================================================
   RESET & BASE STYLES
   ============================================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ============================================================================
   CONTAINER & BOX LAYOUT
   ============================================================================ */
.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

.login-box,
.profile-box {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
    margin: 0 auto;
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */
h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 1.5rem;
    text-align: center;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

h2:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* ============================================================================
   FORMS
   ============================================================================ */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

/* Input Wrapper - contains input field + icons */
.input-wrapper {
    position: relative;
    display: block;
}

.form-control {
    width: 100%;
    padding: 0.75rem 2.8rem 0.75rem 1rem; /* Padding-right for single icon (X button) */
    font-size: 1rem;
    line-height: 1.5;
    color: #2d3748;
    background-color: #ffffff;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Extra padding for fields with toggle icon (eye + X) */
.form-control.has-toggle {
    padding-right: 4rem;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control:invalid:not(:placeholder-shown) {
    border-color: #f56565;
}

.form-text {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: #718096;
}

/* Toggle Password Icon (Eye) */
.toggle-password {
    position: absolute;
    right: 40px; /* Positioned before the X button */
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #a0aec0;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
}

.toggle-password:hover {
    color: #667eea;
}

.toggle-password:active {
    transform: translateY(-50%) scale(0.95);
}

.eye-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* Clear Input Button (X) */
.clear-input {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #a0aec0;
    font-size: 22px;
    font-weight: bold;
    line-height: 1;
    transition: color 0.2s ease;
    padding: 5px 8px;
    user-select: none;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
}

.clear-input:hover {
    color: #e53e3e;
}

.clear-input:active {
    transform: translateY(-50%) scale(0.9);
}

/* Honeypot field - hidden from real users (Protection #9, #40) */
.honeypot {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
}

.btn-primary {
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    color: #4a5568;
    background-color: #e2e8f0;
}

.btn-secondary:hover {
    background-color: #cbd5e0;
}

.btn-block {
    display: block;
    width: 100%;
    margin-top: 1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ============================================================================
   ALERTS
   ============================================================================ */
.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.alert-error {
    background-color: #fed7d7;
    color: #742a2a;
    border: 1px solid #fc8181;
}

.alert-warning {
    background-color: #feebc8;
    color: #744210;
    border: 1px solid #f6ad55;
}

.alert-success {
    background-color: #c6f6d5;
    color: #22543d;
    border: 1px solid #68d391;
}

/* ============================================================================
   PROFILE PAGE SPECIFIC
   ============================================================================ */
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.profile-header h1 {
    margin-bottom: 0;
    text-align: left;
}

.account-info {
    background-color: #f7fafc;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: #4a5568;
}

.info-value {
    color: #2d3748;
    text-align: right;
}

.password-change {
    margin-top: 0;
}

/* ============================================================================
   hCAPTCHA
   ============================================================================ */
.h-captcha {
    margin: 1rem 0;
}

/* ============================================================================
   RESPONSIVE DESIGN - TABLET (768px and up)
   ============================================================================ */
@media (min-width: 768px) {
    body {
        padding: 40px;
    }
    
    .login-box,
    .profile-box {
        padding: 40px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .container {
        max-width: 520px;
    }
}

/* ============================================================================
   RESPONSIVE DESIGN - DESKTOP (1024px and up)
   ============================================================================ */
@media (min-width: 1024px) {
    .container {
        max-width: 560px;
    }
    
    .login-box,
    .profile-box {
        padding: 50px;
    }
    
    .form-group {
        margin-bottom: 1.5rem;
    }
}

/* ============================================================================
   RESPONSIVE DESIGN - MOBILE TOUCH IMPROVEMENTS
   ============================================================================ */
@media (max-width: 767px) {
    /* Increase touch targets on mobile */
    .toggle-password,
    .clear-input {
        padding: 10px;
    }
    
    /* Slightly larger icons on mobile for easier tapping */
    .eye-icon {
        width: 22px;
        height: 22px;
    }
    
    .clear-input {
        font-size: 24px;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */
/* Focus visible for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Skip to content link (for screen readers) */
.skip-to-content {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 999;
    padding: 1em;
    background-color: #667eea;
    color: white;
    text-decoration: none;
}

.skip-to-content:focus {
    left: 0;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */
@media print {
    body {
        background: white;
    }
    
    .btn,
    .h-captcha,
    .honeypot {
        display: none;
    }
    
    .login-box,
    .profile-box {
        box-shadow: none;
    }
}