/**
 * ALGOPK Solar System Recommender
 * Main Global Styles
 */

/* =====================================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ===================================================== */
:root {
    /* Colors */
    --blue-dark: #0D3B6E;
    --blue-mid: #1565C0;
    --blue-light: #D6E4F7;
    --blue-header: #1A56A0;
    --accent: #F59E0B;
    --white: #FFFFFF;
    --gray-light: #F4F6F9;
    --gray-mid: #E2E8F0;
    --gray-dark: #64748B;
    --text-dark: #1A202C;
    --text-mid: #2D3748;
    --green-light: #D1FAE5;
    --green-dark: #065F46;
    --orange-light: #FEF3C7;
    --orange-dark: #92400E;
    --red-light: #FEE2E2;
    --red-dark: #991B1B;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 50px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(21, 101, 192, 0.08);
    --shadow-md: 0 4px 24px rgba(21, 101, 192, 0.12);
    --shadow-lg: 0 8px 40px rgba(21, 101, 192, 0.16);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
    
    /* Fonts */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-urdu: 'Noto Nastaliq Urdu', serif;
}

/* =====================================================
   RESET & BASE STYLES
   ===================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    color: var(--text-mid);
    background: var(--white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* RTL Support for Urdu */
body.rtl {
    direction: rtl;
    font-family: var(--font-urdu);
}

body.rtl * {
    font-family: var(--font-urdu);
}

/* =====================================================
   TYPOGRAPHY
   ===================================================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-dark);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: var(--spacing-md);
}

a {
    color: var(--blue-mid);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--blue-dark);
}

/* =====================================================
   UTILITY CLASSES
   ===================================================== */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.hidden { display: none !important; }
.visible { display: block !important; }

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue-mid) 0%, var(--blue-dark) 100%);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--gray-light);
    color: var(--text-dark);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-mid);
}

.btn-accent {
    background: var(--accent);
    color: var(--white);
}

.btn-accent:hover:not(:disabled) {
    background: #D97706;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: var(--spacing-lg);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    border-bottom: 2px solid var(--gray-light);
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.card-title {
    font-size: 1.5rem;
    color: var(--blue-dark);
    margin-bottom: 0;
}

/* =====================================================
   FORMS
   ===================================================== */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: var(--spacing-sm);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-mid);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--blue-mid);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* =====================================================
   BADGES & PILLS
   ===================================================== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-primary {
    background: var(--blue-light);
    color: var(--blue-dark);
}

.badge-success {
    background: var(--green-light);
    color: var(--green-dark);
}

.badge-warning {
    background: var(--orange-light);
    color: var(--orange-dark);
}

.badge-danger {
    background: var(--red-light);
    color: var(--red-dark);
}

/* =====================================================
   LOADING SPINNER
   ===================================================== */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-light);
    border-top-color: var(--blue-mid);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* =====================================================
   RESPONSIVE BREAKPOINTS
   ===================================================== */
@media (max-width: 1279px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
}

@media (max-width: 1023px) {
    .container {
        padding: 0 var(--spacing-md);
    }
}

@media (max-width: 767px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .btn {
        width: 100%;
    }
}

/* =====================================================
   ACCESSIBILITY
   ===================================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

*:focus-visible {
    outline: 3px solid var(--blue-mid);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
