/* 
 * Rajayog Main CSS
 * Mobile-first responsive design
 */

/* ==========================================================================
   CSS Variables (Custom Properties)
   ========================================================================== */
:root {
    /* Primary Colors */
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    /* Status Colors */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    /* Neutral Colors */
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --text-color: #334155;
    --text-muted: #64748b;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    
    /* Borders */
    --border-radius: 0.5rem;
    --border-radius-lg: 1rem;
    --border-color: #e2e8f0;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    background-color: #ffffff;
    line-height: 1.5;
    /* overflow-x: hidden; -- REMOVED: This was hiding overflow instead of fixing it. Fix the actual offenders instead. */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    flex: 1;
    padding-bottom: var(--space-xl);
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: var(--space-md);
    font-weight: 700;
    line-height: 1.2;
    color: var(--dark-color);
}

h1 {
    font-size: clamp(2rem, 5vw, 3rem);
}

h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
}

h3 {
    font-size: clamp(1.5rem, 3.5vw, 2rem);
}

h4 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

h5 {
    font-size: clamp(1.125rem, 2.5vw, 1.5rem);
}

h6 {
    font-size: clamp(1rem, 2vw, 1.25rem);
}

p {
    margin-top: 0;
    margin-bottom: var(--space-md);
}

small {
    font-size: 0.875em;
}

/* ==========================================================================
   Links
   ========================================================================== */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Keyboard focus styles */
body.keyboard-focus a:focus-visible,
body.keyboard-focus button:focus-visible,
body.keyboard-focus input:focus-visible,
body.keyboard-focus select:focus-visible,
body.keyboard-focus textarea:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    transition: all var(--transition-normal);
    min-height: 44px; /* WCAG touch target size */
    min-width: 44px;
    position: relative;
}

.btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-outline-primary {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Button sizes */
.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1.125rem;
    border-radius: var(--border-radius-lg);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    min-height: 36px;
    min-width: 36px;
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form-control,
.form-select {
    min-height: 44px;
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-color);
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: 0;
}

.form-label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
    color: var(--dark-color);
}

.form-text {
    display: block;
    margin-top: var(--space-xs);
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: white;
    background-clip: border-box;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-body {
    flex: 1 1 auto;
    padding: var(--space-lg);
}

.card-title {
    margin-bottom: var(--space-sm);
    font-weight: 600;
}

.card-text {
    margin-bottom: var(--space-md);
}

/* ==========================================================================
   Alerts
   ========================================================================== */
.alert {
    position: relative;
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-md);
    border: 1px solid transparent;
    border-radius: var(--border-radius);
}

.alert-dismissible {
    padding-right: 3.5rem;
}

.alert-dismissible .btn-close {
    position: absolute;
    top: 50%;
    right: var(--space-md);
    transform: translateY(-50%);
    padding: 0.75rem;
}

/* ==========================================================================
   Utilities
   ========================================================================== */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==========================================================================
   Skip to Content
   ========================================================================== */
.skip-to-content {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    z-index: 9999;
    padding: var(--space-sm) var(--space-md);
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    transform: translateY(-100%);
    transition: transform var(--transition-fast);
}

.skip-to-content:focus {
    transform: translateY(0);
}

/* ==========================================================================
   Responsive Breakpoints - Laptop Optimizations
   ========================================================================== */

/* Tablets and Small Laptops (768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    :root {
        --space-xs: 0.2rem;
        --space-sm: 0.4rem;
        --space-md: 0.85rem;
        --space-lg: 1.25rem;
        --space-xl: 1.75rem;
    }
    
    body {
        font-size: 0.95rem;
    }
    
    .container {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.65rem; }
    h3 { font-size: 1.4rem; }
    h4 { font-size: 1.2rem; }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn-lg {
        padding: 0.7rem 1.5rem;
        font-size: 1rem;
    }
}

/* Standard Laptops (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .container {
        max-width: 960px;
    }
    
    body {
        font-size: 0.98rem;
    }
    
    .row {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
    }
    
    .row > * {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .card-body {
        padding: 1.25rem;
    }
}

/* Large Desktops (1200px+) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Extra Large Desktops (1400px+) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .navbar,
    footer,
    .btn,
    .alert,
    .skip-to-content,
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .card {
        border: 1px solid #000;
        box-shadow: none;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.9em;
        font-weight: normal;
    }
}

/* ==========================================================================
   Language-Specific Typography
   ========================================================================== */

/* Hindi (Devanagari Script) */
[lang="hi"], 
[lang="hi"] * {
    font-family: 'Noto Sans Devanagari', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.7; /* Taller line height for diacritics */
}

/* Malayalam Script */
[lang="ml"],
[lang="ml"] * {
    font-family: 'Noto Sans Malayalam', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
}

/* English (Default) */
[lang="en"],
[lang="en"] * {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Language selector styling for native scripts */
.lang-select option[value="ml"],
.lang-select option[value="hi"] {
    font-size: 0.9rem;
}
