/* ========================================
   BASE STYLES - HTML5 & CSS3 Standards
   ======================================== */

/* ========================================
   CSS RESET & NORMALIZE
   ======================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    line-height: var(--line-height-normal);
    /* text-size-adjust: Safari/Chrome only, deprecated in favor of font-size scaling */
    -webkit-font-smoothing: antialiased; /* Safari/Chrome */
    text-rendering: optimizeLegibility;
    font-feature-settings: 'kern' 1;
    font-kerning: normal;
    font-variant-ligatures: common-ligatures;
}

body {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-text);
    background-color: var(--color-background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   TYPOGRAPHY - HTML5 Semantic Elements
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--color-text);
    margin-bottom: var(--space-4);
}

h1 {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-extrabold);
}

h2 {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
}

h3 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
}

h4 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
}

h5 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
}

h6 {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
}

p {
    margin-bottom: var(--space-4);
    line-height: var(--line-height-relaxed);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition-colors);
}

a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ========================================
   LISTS - Semantic HTML5 Lists
   ======================================== */

ul, ol {
    margin-bottom: var(--space-4);
    padding-left: var(--space-6);
}

li {
    margin-bottom: var(--space-2);
    line-height: var(--line-height-relaxed);
}

ul {
    list-style-type: disc;
}

ol {
    list-style-type: decimal;
}

/* ========================================
   TABLES - HTML5 Table Elements
   ======================================== */

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    margin-bottom: var(--space-6);
}

th, td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

th {
    font-weight: var(--font-weight-semibold);
    background-color: var(--color-surface);
    color: var(--color-text);
}

tr:hover {
    background-color: var(--color-surface-2);
}

/* ========================================
   FORMS - HTML5 Form Elements
   ======================================== */

input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

input, textarea, select {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    transition: var(--transition-colors);
    width: 100%;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

input:invalid {
    border-color: var(--color-error);
}

input:valid {
    border-color: var(--color-success);
}

label {
    display: block;
    font-weight: var(--font-weight-medium);
    margin-bottom: var(--space-2);
    color: var(--color-text);
}

/* ========================================
   BUTTONS - Interactive Elements
   ======================================== */

button {
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-6);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: var(--transition-all);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

button:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

button:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ========================================
   IMAGES - Responsive Images
   ======================================== */

img {
    max-width: 100%;
    height: auto;
    display: block;
}

picture {
    display: block;
}

/* ========================================
   ACCESSIBILITY - WCAG 2.1 AA Compliance
   ======================================== */

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Skip links */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--color-primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: var(--radius-md);
    z-index: var(--z-index-skiplink);
}

.skip-link:focus {
    top: 6px;
}

/* ========================================
   AUTH FORMS - Login/Register Specific
   ======================================== */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height) - var(--footer-height) - 4rem);
    padding: 2rem 0;
}

.auth-form {
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.auth-form h2 {
    color: var(--color-text);
    text-align: center;
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.auth-form .form-group {
    margin-bottom: 1.5rem;
}

.auth-form .btn {
    width: 100%;
    margin-top: 1rem;
}

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.auth-links a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* ========================================
   PASSWORD STRENGTH INDICATOR
   ======================================== */

.password-strength {
    margin-top: 0.5rem;
}

.strength-bar {
    height: 4px;
    background-color: var(--color-surface-2);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.strength-fill {
    height: 100%;
    transition: all 0.3s ease;
}

.strength-weak .strength-fill {
    background-color: var(--color-error);
    width: 25%;
}

.strength-fair .strength-fill {
    background-color: var(--color-warning);
    width: 50%;
}

.strength-good .strength-fill {
    background-color: var(--color-primary);
    width: 75%;
}

.strength-strong .strength-fill {
    background-color: var(--color-success);
    width: 100%;
}

.strength-text {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* ========================================
   RECAPTCHA STYLES - Small Logo Only
   ======================================== */

.grecaptcha-badge {
    position: fixed !important;
    bottom: 100px !important;
    right: 20px !important;
    z-index: 1000 !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 70px !important;
    height: 60px !important;
    overflow: hidden !important;
}

iframe[src*="recaptcha"] {
    position: fixed !important;
    bottom: 100px !important;
    right: 20px !important;
    z-index: 1000 !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 70px !important;
    height: 60px !important;
    border: none !important;
}

/* ========================================
   RESPONSIVE DESIGN - Mobile First
   ======================================== */

/* Mobile styles (default) */
.container {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* Global Typography Scaling */
h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }
h4 { font-size: var(--font-size-base); }
h5 { font-size: var(--font-size-sm); }
h6 { font-size: var(--font-size-xs); }

/* Global Form Responsive */
.form-row {
    grid-template-columns: 1fr;
    gap: var(--space-3);
}

/* Global Button Responsive */
.btn {
    width: 100%;
    justify-content: center;
}

/* Global Card Responsive */
.card {
    margin-bottom: var(--space-4);
}

/* Tablet and up */
@media (min-width: 768px) {
    .container {
        padding: 0 var(--space-6);
    }
    
    /* Typography scaling */
    h1 { font-size: var(--font-size-3xl); }
    h2 { font-size: var(--font-size-2xl); }
    h3 { font-size: var(--font-size-xl); }
    
    /* Form responsive */
    .form-row {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-4);
    }
    
    /* Button responsive */
    .btn {
        width: auto;
    }
    
    /* Card responsive */
    .card {
        margin-bottom: var(--space-6);
    }
}

/* Desktop and up */
@media (min-width: 1024px) {
    .container {
        padding: 0 var(--space-8);
    }
    
    /* Typography scaling */
    h1 { font-size: var(--font-size-4xl); }
    h2 { font-size: var(--font-size-3xl); }
    h3 { font-size: var(--font-size-2xl); }
    
    /* Form responsive */
    .form-row {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-6);
    }
    
    /* Card responsive */
    .card {
        margin-bottom: var(--space-8);
    }
}

/* Large Desktop */
@media (min-width: 1280px) {
    .container {
        max-width: 1200px;
    }
}
