/* ============================================================================
   CATABASE GLOBAL STYLES
   Corporate Identity Implementation
   Version 1.0 | November 2025
   
   This file contains:
   - CSS Variables (colors, spacing, typography)
   - Reusable component classes (buttons, forms, cards, badges)
   - Base styles and utilities
   
   Reference: Catabase_Corporate_Identity_Guide.docx
   ============================================================================ */

/* ============================================================================
   CSS VARIABLES
   ============================================================================ */

:root {
    /* Grey Scale - Foundation palette */
    --grey-900: #333333;    /* Primary text, headings */
    --grey-700: #666666;    /* Secondary text, labels */
    --grey-500: #999999;    /* Headers, borders, disabled state */
    --grey-300: #CCCCCC;    /* Dividers, subtle borders */
    --grey-100: #F5F5F5;    /* Page backgrounds, cards */
    --grey-50: #FAFAFA;     /* Hover states, alternating rows */
    
    /* Blue Accents - Interactive elements */
    --primary-blue: #4A5568;    /* Primary buttons, key actions */
    --blue-hover: #2D3748;      /* Button hover states */
    --blue-active: #1A202C;     /* Button active states */
    --blue-light: #E2E8F0;      /* Button backgrounds, subtle highlights */
    
    /* Semantic Colors - Status & feedback */
    --success: #38A169;         /* Success messages, confirmations */
    --success-light: #C6F6D5;   /* Success backgrounds */
    --success-dark: #22543D;    /* Success text */
    
    --warning: #FFF3CD;         /* Warning banners, instructions */
    --warning-dark: #744210;    /* Warning text */
    
    --error: #D74E4E;           /* Error messages, destructive actions */
    --error-light: #FED7D7;     /* Error backgrounds */
    --error-dark: #8B3A3A;      /* Error text */
    
    --info: #3182CE;            /* Informational messages, tips */
    --info-light: #BEE3F8;      /* Info backgrounds */
    --info-dark: #2C5282;       /* Info text */
    
    /* Role Badge Colors */
    --badge-admin-bg: #FFB3B3;
    --badge-admin-text: #8B0000;
    
    --badge-staff-bg: #B3D9FF;
    --badge-staff-text: #003366;
    
    --badge-coordinator-bg: #D4A5FF;
    --badge-coordinator-text: #4B0082;
    
    --badge-member-bg: #B3FFB3;
    --badge-member-text: #006400;
    
    /* Spacing - 8px grid system */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 18px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --spacing-3xl: 64px;
    --spacing-4xl: 96px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 50%;
    
    /* Typography */
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.2);
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
}

html {
    scroll-padding-top: 120px; /* 60px header + 20px breathing room */
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    color: var(--grey-900);
    background-color: white;
    margin: 0;
    padding: 0;
}

/* Typography base */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    font-weight: 700;
    color: var(--grey-900);
}

h1 {
    font-size: 32px;
    line-height: 1.2;
}

h2 {
    font-size: 24px;
    line-height: 1.3;
}

h3 {
    font-size: 20px;
    line-height: 1.4;
    font-weight: 600;
}

p {
    margin-top: 0;
    margin-bottom: var(--spacing-md);
}

/* Links */
a {
    color: var(--info);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

a:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Focus states for accessibility */
:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* ============================================================================
   BUTTON COMPONENTS
   ============================================================================ */

/* Base button styles */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    text-decoration: none;
    line-height: 1.5;
}

.btn:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Primary Button - Main actions */
.btn-primary {
    background-color: var(--primary-blue);
    color: white;
    border: none;
}

.btn-primary:hover {
    background-color: var(--blue-hover);
    text-decoration: none;
}

.btn-primary:active {
    background-color: var(--blue-active);
}

.btn-primary:disabled {
    background-color: #CBD5E0;
    color: #A0AEC0;
    cursor: not-allowed;
}

/* Secondary Button - Alternative actions */
.btn-secondary {
    background-color: #EDF2F7;
    color: var(--primary-blue);
    border: 1px solid #CBD5E0;
}

.btn-secondary:hover {
    background-color: #E2E8F0;
    border-color: #A0AEC0;
    text-decoration: none;
}

.btn-secondary:active {
    background-color: #CBD5E0;
}

.btn-secondary:disabled {
    color: #CBD5E0;
    cursor: not-allowed;
}

/* Tertiary Button - Subtle actions */
.btn-tertiary {
    background-color: transparent;
    color: var(--primary-blue);
    border: none;
    padding: 8px 16px;
    font-weight: 500;
}

.btn-tertiary:hover {
    background-color: #F7FAFC;
    text-decoration: none;
}

.btn-tertiary:active {
    background-color: #EDF2F7;
}

/* Danger Button - Destructive actions */
.btn-danger {
    background-color: var(--error);
    color: white;
    border: none;
}

.btn-danger:hover {
    background-color: #C53030;
    text-decoration: none;
}

.btn-danger:active {
    background-color: #9B2C2C;
}

/* Button Sizes */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* Button with icon */
.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* ============================================================================
   FORM COMPONENTS
   ============================================================================ */

/* Form labels */
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 6px;
}

.form-label.required::after {
    content: " *";
    color: var(--error);
}

/* Text inputs */
.input-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #CBD5E0;
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--grey-900);
    background-color: white;
    font-family: var(--font-body);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(74, 85, 104, 0.1);
}

.input-field::placeholder {
    color: #A0AEC0;
}

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

.input-field.error:focus {
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.input-field:disabled {
    background-color: #F7FAFC;
    border-color: #E2E8F0;
    cursor: not-allowed;
    color: #A0AEC0;
}

/* Select dropdowns */
.select-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #CBD5E0;
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--grey-900);
    background-color: white;
    font-family: var(--font-body);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.select-field:hover {
    border-color: #A0AEC0;
}

.select-field:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(74, 85, 104, 0.1);
}

/* Textareas */
.textarea-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #CBD5E0;
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--grey-900);
    background-color: white;
    font-family: var(--font-body);
    resize: vertical;
    min-height: 100px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.textarea-field:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(74, 85, 104, 0.1);
}

/* Checkboxes and Radio Buttons */
.checkbox-wrapper,
.radio-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.checkbox-input,
.radio-input {
    width: 18px;
    height: 18px;
    border: 2px solid #CBD5E0;
    cursor: pointer;
}

.checkbox-input {
    border-radius: 3px;
}

.radio-input {
    border-radius: var(--radius-full);
}

.checkbox-input:checked,
.radio-input:checked {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}

.checkbox-input:focus,
.radio-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 85, 104, 0.1);
}

.checkbox-label,
.radio-label {
    font-size: 14px;
    color: var(--grey-900);
    cursor: pointer;
    user-select: none;
}

/* Form help text */
.form-help {
    display: block;
    font-size: 12px;
    color: #718096;
    margin-top: 4px;
}

/* Form error messages */
.form-error {
    display: block;
    font-size: 12px;
    color: var(--error);
    margin-top: 4px;
}

/* Form groups */
.form-group {
    margin-bottom: var(--spacing-md);
}

/* ============================================================================
   CARD COMPONENTS
   ============================================================================ */

.card {
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    font-size: 20px;
    font-weight: 600;
    color: var(--grey-900);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid #E2E8F0;
}

.card-body {
    font-size: 14px;
    line-height: 1.6;
    color: var(--grey-700);
}

.card-footer {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid #E2E8F0;
}

/* ============================================================================
   BADGE COMPONENTS
   ============================================================================ */

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-xl);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-admin {
    background-color: var(--badge-admin-bg);
    color: var(--badge-admin-text);
}

.badge-staff {
    background-color: var(--badge-staff-bg);
    color: var(--badge-staff-text);
}

.badge-regional-coordinator {
    background-color: var(--badge-coordinator-bg);
    color: var(--badge-coordinator-text);
}

.badge-member {
    background-color: var(--badge-member-bg);
    color: var(--badge-member-text);
}

/* ============================================================================
   AVATAR COMPONENTS
   ============================================================================ */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--grey-500);
    color: white;
    font-weight: 700;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.avatar-lg {
    width: 80px;
    height: 80px;
    font-size: 32px;
}

.avatar-md {
    width: 40px;
    height: 40px;
    font-size: 16px;
}

.avatar-sm {
    width: 24px;
    height: 24px;
    font-size: 10px;
}

/* ============================================================================
   FLASH MESSAGE COMPONENTS
   ============================================================================ */

.flash-message {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 600px;
    width: 90%;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideDown var(--transition-medium);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.flash-success {
    background-color: var(--success-light);
    color: var(--success-dark);
    border-left: 4px solid var(--success);
}

.flash-error {
    background-color: var(--error-light);
    color: var(--error-dark);
    border-left: 4px solid var(--error);
}

.flash-warning {
    background-color: var(--warning);
    color: var(--warning-dark);
    border-left: 4px solid #D69E2E;
}

.flash-info {
    background-color: var(--info-light);
    color: var(--info-dark);
    border-left: 4px solid var(--info);
}

.flash-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    margin-left: var(--spacing-md);
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.flash-close:hover {
    opacity: 1;
}

/* ============================================================================
   MODAL COMPONENTS
   ============================================================================ */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--transition-fast);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-container {
    background: white;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--spacing-lg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: scaleIn var(--transition-fast);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: none;
    border: none;
    font-size: 24px;
    color: var(--grey-700);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
}

.modal-close:hover {
    background-color: var(--grey-100);
}

/* ============================================================================
   TABLE COMPONENTS
   ============================================================================ */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    background-color: var(--grey-100);
    color: var(--grey-900);
    font-weight: 600;
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid var(--grey-300);
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--grey-300);
}

.table tbody tr:hover {
    background-color: var(--grey-50);
}

.table-striped tbody tr:nth-child(even) {
    background-color: var(--grey-50);
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

/* Spacing utilities */
.mt-xs { margin-top: var(--spacing-xs); }
.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-xs { margin-bottom: var(--spacing-xs); }
.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); }

.pt-xs { padding-top: var(--spacing-xs); }
.pt-sm { padding-top: var(--spacing-sm); }
.pt-md { padding-top: var(--spacing-md); }
.pt-lg { padding-top: var(--spacing-lg); }
.pt-xl { padding-top: var(--spacing-xl); }

.pb-xs { padding-bottom: var(--spacing-xs); }
.pb-sm { padding-bottom: var(--spacing-sm); }
.pb-md { padding-bottom: var(--spacing-md); }
.pb-lg { padding-bottom: var(--spacing-lg); }
.pb-xl { padding-bottom: var(--spacing-xl); }

/* Text utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-sm { font-size: 12px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-normal { font-weight: 400; }

.text-grey-900 { color: var(--grey-900); }
.text-grey-700 { color: var(--grey-700); }
.text-grey-500 { color: var(--grey-500); }

.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning-dark); }
.text-info { color: var(--info); }

/* Display utilities */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }

/* Flexbox utilities */
.flex-row { flex-direction: row; }
.flex-column { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* Width utilities */
.w-full { width: 100%; }
.max-w-container { max-width: 1400px; margin: 0 auto; }

/* ============================================================================
   HEADER & FOOTER SPECIFIC STYLES
   ============================================================================ */

.site-header {
    background-color: var(--grey-500);
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-lg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-header .logo {
    height: 60px;
    width: auto;
}

.header-nav {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.site-footer {
    background-color: var(--blue-light);
    padding: var(--spacing-lg) 0;
    text-align: center;
    margin-top: auto;
}

.footer-social-icons {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.footer-social-icons a {
    display: inline-block;
    transition: transform var(--transition-fast);
}

.footer-social-icons a:hover {
    transform: scale(1.1);
}

.footer-social-icons img {
    width: 40px;
    height: 40px;
}

.footer-links {
    font-size: 12px;
    color: #718096;
    margin-bottom: var(--spacing-sm);
}

.footer-links a {
    color: #718096;
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--grey-900);
    text-decoration: underline;
}

.footer-copyright {
    font-size: 12px;
    color: #718096;
}

/* ============================================================================
   RESPONSIVE STYLES
   ============================================================================ */

/* Mobile - < 640px */
@media (max-width: 639px) {
    .site-header {
        padding: 0 var(--spacing-md);
    }
    
    .site-header .logo {
        height: 32px;
    }
    
    .header-nav .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .modal-container {
        width: 95%;
        padding: var(--spacing-md);
    }
    
    .card {
        padding: var(--spacing-md);
    }
}

/* Tablet - 640px to 1024px */
@media (min-width: 640px) and (max-width: 1023px) {
    .max-w-container {
        padding: 0 var(--spacing-lg);
    }
}

/* Desktop - 1024px+ */
@media (min-width: 1024px) {
    .max-w-container {
        padding: 0 var(--spacing-xl);
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .site-header,
    .site-footer,
    .btn,
    .flash-message,
    .modal-backdrop {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: black;
    }
}