/* Help Scout Design System CSS - Modern & Beautiful
 * Inspired by contemporary Help Scout design
 * Enhanced with modern aesthetics and visual appeal
 */

/* ==========================================
 * CSS CUSTOM PROPERTIES (DESIGN TOKENS)
 * ========================================== */

:root {
    /* Primary Colors - Modern Help Scout Orange/Coral */
    --primary-50: #fff7f4;
    --primary-100: #ffede5;
    --primary-200: #ffd6c2;
    --primary-300: #ffb894;
    --primary-400: #ff8f5a;
    --primary-500: #ff6b35;
    --primary-600: #f55a2c;
    --primary-700: #e04620;
    --primary-800: #c93e1d;
    --primary-900: #a3351a;

    /* Neutral Colors - Sophisticated Grays */
    --neutral-50: #fafbfc;
    --neutral-100: #f4f6f8;
    --neutral-200: #e8ecf0;
    --neutral-300: #d4dbe1;
    --neutral-400: #b8c4ce;
    --neutral-500: #9aa5b1;
    --neutral-600: #7b8794;
    --neutral-700: #616e7c;
    --neutral-800: #52606d;
    --neutral-900: #3e4c59;
    --neutral-950: #1a202c;

    /* Semantic Colors */
    --success-50: #f0fdf9;
    --success-100: #ccfbef;
    --success-500: #10b981;
    --success-600: #059669;
    
    --warning-50: #fffbeb;
    --warning-100: #fef3c7;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    
    --error-50: #fef2f2;
    --error-100: #fee2e2;
    --error-500: #ef4444;
    --error-600: #dc2626;

    --info-50: #eff6ff;
    --info-100: #dbeafe;
    --info-500: #3b82f6;
    --info-600: #2563eb;

    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* ==========================================
 * BASE STYLES & RESET
 * ========================================== */

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

html {
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    background-color: var(--neutral-50);
    color: var(--neutral-900);
    font-weight: var(--font-weight-normal);
}

/* Typography Improvements */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
    margin: 0 0 var(--space-md) 0;
    color: var(--neutral-950);
}

p {
    margin: 0 0 var(--space-md) 0;
    line-height: 1.7;
}

a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-700);
}

/* ==========================================
 * MODERN COMPONENT LIBRARY
 * ========================================== */

/* Enhanced Alert Component */
.c-alert {
    background: linear-gradient(135deg, var(--warning-50) 0%, rgba(255, 251, 235, 0.8) 100%);
    border: 1px solid var(--warning-200);
    border-left: 4px solid var(--warning-500);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.c-alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--warning-300), transparent);
}

.c-alert.is-error {
    background: linear-gradient(135deg, var(--error-50) 0%, rgba(254, 242, 242, 0.8) 100%);
    border-color: var(--error-200);
    border-left-color: var(--error-500);
}

.c-alert.is-success {
    background: linear-gradient(135deg, var(--success-50) 0%, rgba(240, 253, 249, 0.8) 100%);
    border-color: var(--success-200);
    border-left-color: var(--success-500);
}

.c-alert.is-info {
    background: linear-gradient(135deg, var(--info-50) 0%, rgba(239, 246, 255, 0.8) 100%);
    border-color: var(--info-200);
    border-left-color: var(--info-500);
}

/* Beautiful Avatar Component */
.c-avatar {
    background: linear-gradient(135deg, var(--neutral-100), var(--neutral-200));
    border: 2px solid white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: block;
    overflow: hidden;
    position: relative;
    height: 50px;
    width: 50px;
    transition: all 0.3s ease;
}

.c-avatar:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.c-avatar > img,
.c-avatar__image {
    transform: translateX(-50%);
    bottom: 0;
    display: block;
    height: auto;
    left: 50%;
    margin: auto;
    max-width: 200%;
    max-height: 100%;
    min-height: 100%;
    min-width: 100%;
    position: absolute;
    top: 0;
    width: auto;
}

.c-avatar--rounded {
    border-radius: var(--radius-full);
}

/* Avatar Sizes with Enhanced Styling */
.c-avatar--xl { 
    height: 72px; 
    width: 72px; 
    border-width: 3px;
}
.c-avatar--lg { 
    height: 50px; 
    width: 50px; 
    border-width: 2px;
}
.c-avatar--md { 
    height: 36px; 
    width: 36px; 
    border-width: 2px;
}
.c-avatar--sm { 
    height: 32px; 
    width: 32px; 
    border-width: 1px;
}
.c-avatar--xs { 
    height: 28px; 
    width: 28px; 
    border-width: 1px;
}

/* Modern Badge Component */
.c-badge {
    background: linear-gradient(135deg, var(--neutral-500), var(--neutral-600));
    border-radius: var(--radius-full);
    color: white;
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    padding: var(--space-xs) var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: var(--shadow-xs);
    transition: all 0.2s ease;
}

.c-badge:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.c-badge.is-error { 
    background: linear-gradient(135deg, var(--error-500), var(--error-600)); 
}
.c-badge.is-info { 
    background: linear-gradient(135deg, var(--info-500), var(--info-600)); 
}
.c-badge.is-success { 
    background: linear-gradient(135deg, var(--success-500), var(--success-600)); 
}
.c-badge.is-warning { 
    background: linear-gradient(135deg, var(--warning-500), var(--warning-600)); 
}

/* Stunning Card Component */
.c-card {
    background: white;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.c-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--neutral-300);
}

.c-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-400), var(--primary-600));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.c-card:hover::before {
    opacity: 1;
}

.c-card__block {
    padding: var(--space-xl);
}

.c-card__block + .c-card__block {
    border-top: 1px solid var(--neutral-100);
}

.c-card__block--sm { padding: var(--space-lg); }
.c-card__block--xs { padding: var(--space-md); }

/* Enhanced List Component */
.c-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.c-list > li,
.c-list__item {
    padding: var(--space-sm) 0;
    transition: all 0.2s ease;
}

.c-list--bordered > .c-list__item,
.c-list--bordered > li {
    border-bottom: 1px solid var(--neutral-200);
    padding: var(--space-md) 0;
}

.c-list--bordered > .c-list__item:hover,
.c-list--bordered > li:hover {
    background-color: var(--neutral-50);
    padding-left: var(--space-md);
    margin-left: calc(-1 * var(--space-md));
    margin-right: calc(-1 * var(--space-md));
    padding-right: var(--space-md);
}

/* Form Components with Modern Styling */
.c-form-group {
    margin-bottom: var(--space-xl);
}

.c-form-group label {
    display: block;
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-sm);
    color: var(--neutral-800);
}

.c-input {
    width: 100%;
    padding: var(--space-md);
    border: 2px solid var(--neutral-200);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
}

.c-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.c-form-group.is-error .c-input {
    border-color: var(--error-500);
}

.c-form-group.is-error .c-input:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.c-form-group.is-success .c-input {
    border-color: var(--success-500);
}

/* Modern Button Styles */
.c-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md) var(--space-xl);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 1rem;
    gap: var(--space-sm);
}

.c-btn--primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    box-shadow: var(--shadow-md);
}

.c-btn--primary:hover {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.c-btn--secondary {
    background: white;
    color: var(--neutral-700);
    border: 2px solid var(--neutral-300);
    box-shadow: var(--shadow-sm);
}

.c-btn--secondary:hover {
    background: var(--neutral-50);
    border-color: var(--neutral-400);
    transform: translateY(-1px);
}

/* ==========================================
 * MODERN LAYOUT SYSTEM
 * ========================================== */

/* Enhanced Container */
.o-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.o-container--fluid {
    max-width: none;
}

/* Improved Grid System */
.o-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 calc(-1 * var(--space-md));
}

.o-col, [class*="o-col-"] {
    padding: 0 var(--space-md);
    width: 100%;
}

.o-col-1 { width: 8.33333%; }
.o-col-2 { width: 16.66667%; }
.o-col-3 { width: 25%; }
.o-col-4 { width: 33.33333%; }
.o-col-5 { width: 41.66667%; }
.o-col-6 { width: 50%; }
.o-col-7 { width: 58.33333%; }
.o-col-8 { width: 66.66667%; }
.o-col-9 { width: 75%; }
.o-col-10 { width: 83.33333%; }
.o-col-11 { width: 91.66667%; }
.o-col-12 { width: 100%; }

/* Modern Flexbox Utilities */
.o-flexy {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.o-flexy--between { justify-content: space-between; }
.o-flexy--center { justify-content: center; }
.o-flexy--start { justify-content: flex-start; }
.o-flexy--end { justify-content: flex-end; }

.o-flexy--wrap { flex-wrap: wrap; }
.o-flexy--nowrap { flex-wrap: nowrap; }

.o-flexy--top { align-items: flex-start; }
.o-flexy--middle { align-items: center; }
.o-flexy--bottom { align-items: flex-end; }
.o-flexy--stretch { align-items: stretch; }

.o-flexy__item {
    flex: 1;
}

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

/* Spacing Utilities */
.u-mt-0 { margin-top: 0 !important; }
.u-mt-sm { margin-top: var(--space-sm) !important; }
.u-mt-md { margin-top: var(--space-md) !important; }
.u-mt-lg { margin-top: var(--space-lg) !important; }
.u-mt-xl { margin-top: var(--space-xl) !important; }

.u-mb-0 { margin-bottom: 0 !important; }
.u-mb-sm { margin-bottom: var(--space-sm) !important; }
.u-mb-md { margin-bottom: var(--space-md) !important; }
.u-mb-lg { margin-bottom: var(--space-lg) !important; }
.u-mb-xl { margin-bottom: var(--space-xl) !important; }

.u-p-0 { padding: 0 !important; }
.u-p-sm { padding: var(--space-sm) !important; }
.u-p-md { padding: var(--space-md) !important; }
.u-p-lg { padding: var(--space-lg) !important; }
.u-p-xl { padding: var(--space-xl) !important; }

/* Display Utilities */
.u-hidden { display: none !important; }
.u-block { display: block !important; }
.u-inline { display: inline !important; }
.u-inline-block { display: inline-block !important; }
.u-flex { display: flex !important; }

/* Text Utilities */
.u-text-left { text-align: left !important; }
.u-text-center { text-align: center !important; }
.u-text-right { text-align: right !important; }

.u-text-sm { font-size: 0.875rem !important; }
.u-text-md { font-size: 1rem !important; }
.u-text-lg { font-size: 1.125rem !important; }
.u-text-xl { font-size: 1.25rem !important; }

.u-font-normal { font-weight: var(--font-weight-normal) !important; }
.u-font-medium { font-weight: var(--font-weight-medium) !important; }
.u-font-semibold { font-weight: var(--font-weight-semibold) !important; }
.u-font-bold { font-weight: var(--font-weight-bold) !important; }

/* Background Utilities */
.u-bg-white { background-color: white !important; }
.u-bg-primary { background-color: var(--primary-500) !important; }
.u-bg-neutral-50 { background-color: var(--neutral-50) !important; }
.u-bg-neutral-100 { background-color: var(--neutral-100) !important; }

/* Text Color Utilities */
.u-text-primary { color: var(--primary-600) !important; }
.u-text-neutral-600 { color: var(--neutral-600) !important; }
.u-text-neutral-800 { color: var(--neutral-800) !important; }
.u-text-neutral-900 { color: var(--neutral-900) !important; }

/* Border Utilities */
.u-rounded-sm { border-radius: var(--radius-sm) !important; }
.u-rounded-md { border-radius: var(--radius-md) !important; }
.u-rounded-lg { border-radius: var(--radius-lg) !important; }
.u-rounded-xl { border-radius: var(--radius-xl) !important; }
.u-rounded-full { border-radius: var(--radius-full) !important; }

/* Shadow Utilities */
.u-shadow-sm { box-shadow: var(--shadow-sm) !important; }
.u-shadow-md { box-shadow: var(--shadow-md) !important; }
.u-shadow-lg { box-shadow: var(--shadow-lg) !important; }
.u-shadow-xl { box-shadow: var(--shadow-xl) !important; }

/* ==========================================
 * RESPONSIVE DESIGN
 * ========================================== */

@media (min-width: 640px) {
    .sm\:o-col-1 { width: 8.33333%; }
    .sm\:o-col-2 { width: 16.66667%; }
    .sm\:o-col-3 { width: 25%; }
    .sm\:o-col-4 { width: 33.33333%; }
    .sm\:o-col-5 { width: 41.66667%; }
    .sm\:o-col-6 { width: 50%; }
    .sm\:o-col-7 { width: 58.33333%; }
    .sm\:o-col-8 { width: 66.66667%; }
    .sm\:o-col-9 { width: 75%; }
    .sm\:o-col-10 { width: 83.33333%; }
    .sm\:o-col-11 { width: 91.66667%; }
    .sm\:o-col-12 { width: 100%; }

    .sm\:u-flex { display: flex !important; }
    .sm\:u-block { display: block !important; }
    .sm\:u-hidden { display: none !important; }
}

@media (min-width: 768px) {
    .md\:o-col-1 { width: 8.33333%; }
    .md\:o-col-2 { width: 16.66667%; }
    .md\:o-col-3 { width: 25%; }
    .md\:o-col-4 { width: 33.33333%; }
    .md\:o-col-5 { width: 41.66667%; }
    .md\:o-col-6 { width: 50%; }
    .md\:o-col-7 { width: 58.33333%; }
    .md\:o-col-8 { width: 66.66667%; }
    .md\:o-col-9 { width: 75%; }
    .md\:o-col-10 { width: 83.33333%; }
    .md\:o-col-11 { width: 91.66667%; }
    .md\:o-col-12 { width: 100%; }
}

@media (min-width: 1024px) {
    .lg\:o-col-1 { width: 8.33333%; }
    .lg\:o-col-2 { width: 16.66667%; }
    .lg\:o-col-3 { width: 25%; }
    .lg\:o-col-4 { width: 33.33333%; }
    .lg\:o-col-5 { width: 41.66667%; }
    .lg\:o-col-6 { width: 50%; }
    .lg\:o-col-7 { width: 58.33333%; }
    .lg\:o-col-8 { width: 66.66667%; }
    .lg\:o-col-9 { width: 75%; }
    .lg\:o-col-10 { width: 83.33333%; }
    .lg\:o-col-11 { width: 91.66667%; }
    .lg\:o-col-12 { width: 100%; }
}

/* ==========================================
 * ANIMATIONS & TRANSITIONS
 * ========================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.u-animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.u-animate-slide-in {
    animation: slideIn 0.5s ease-out;
}

/* ==========================================
 * ACCESSIBILITY IMPROVEMENTS
 * ========================================== */

.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 {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

/* ==========================================
 * MODERN HR COMPONENT
 * ========================================== */

.c-hr, hr {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--neutral-300), transparent);
    margin: var(--space-xl) 0;
}

/* ==========================================
 * LOADING STATES
 * ========================================== */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.u-loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.u-loading-skeleton {
    background: linear-gradient(90deg, var(--neutral-200) 25%, var(--neutral-100) 50%, var(--neutral-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}