/**
 * QualityHub Pro - Apple-inspired Design System
 *
 * Design-Philosophie:
 * - Klarheit über Features
 * - Weißraum als Design-Element
 * - Typografie als Hierarchie
 * - Animationen mit Bedeutung
 * - Farben mit Zweck
 */

/* ============================================== */
/* 1. CSS RESET & VARIABLES */
/* ============================================== */

:root {
    /* Apple-Style Colors */
    --color-primary: #007AFF;
    --color-success: #34C759;
    --color-warning: #FF9500;
    --color-danger: #FF3B30;
    --color-gray: #8E8E93;
    --color-gray-light: #C7C7CC;
    --color-gray-lighter: #E5E5EA;
    --color-background: #F2F2F7;
    --color-background-elevated: #FFFFFF;
    --color-text-primary: #000000;
    --color-text-secondary: #3C3C43;
    --color-text-tertiary: #8E8E93;

    /* Spacing System (8px base) */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-xxl: 48px;

    /* Typography Scale */
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;
    --font-size-xxl: 32px;
    --font-size-hero: 48px;

    /* Font Weights */
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Shadows (layered, subtle) */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-base: 200ms cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-slow: 350ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ============================================== */
/* 2. TYPOGRAPHY */
/* ============================================== */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    color: var(--color-text-primary);
    background-color: var(--color-background);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.apple-hero {
    font-size: var(--font-size-hero);
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.apple-h1 {
    font-size: var(--font-size-xxl);
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.015em;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

.apple-h2 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin-bottom: var(--spacing-sm);
}

.apple-h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
    line-height: 1.4;
    margin-bottom: var(--spacing-xs);
}

.apple-body {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    line-height: 1.6;
    color: var(--color-text-secondary);
}

.apple-caption {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-regular);
    color: var(--color-text-tertiary);
    line-height: 1.4;
}

.apple-footnote {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-regular);
    color: var(--color-text-tertiary);
    line-height: 1.3;
}

/* ============================================== */
/* 3. CARDS & SURFACES */
/* ============================================== */

.apple-card {
    background: var(--color-background-elevated);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.apple-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

.apple-card-flat {
    background: var(--color-background-elevated);
    border: 1px solid var(--color-gray-lighter);
    box-shadow: none;
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

/* ============================================== */
/* 4. BUTTONS (Apple-Style) */
/* ============================================== */

.apple-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.apple-btn:active {
    transform: scale(0.96);
}

.apple-btn-primary {
    background: var(--color-primary);
    color: white;
}

.apple-btn-primary:hover {
    background: #0051D5;
    color: white;
}

.apple-btn-secondary {
    background: var(--color-gray-lighter);
    color: var(--color-text-primary);
}

.apple-btn-secondary:hover {
    background: var(--color-gray-light);
}

.apple-btn-ghost {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-gray-lighter);
}

.apple-btn-ghost:hover {
    background: var(--color-background);
}

.apple-btn-lg {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-lg);
}

.apple-btn-sm {
    padding: 6px 12px;
    font-size: var(--font-size-sm);
}

/* ============================================== */
/* 5. ACTIVITY FEED */
/* ============================================== */

.apple-activity-feed {
    background: var(--color-background-elevated);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
}

.apple-activity-item {
    display: flex;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-gray-lighter);
    transition: background var(--transition-fast);
}

.apple-activity-item:last-child {
    border-bottom: none;
}

.apple-activity-item:hover {
    background: var(--color-background);
    border-radius: var(--radius-sm);
    margin: 0 -8px;
    padding-left: 8px;
    padding-right: 8px;
}

.apple-activity-avatar {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), var(--color-success));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: var(--font-weight-semibold);
    font-size: 0.7rem;
    flex-shrink: 0;
}

.apple-activity-content {
    flex: 1;
    min-width: 0;
}

.apple-activity-message {
    font-size: 0.85rem;
    color: var(--color-text-primary);
    margin-bottom: 2px;
    line-height: 1.3;
}

.apple-activity-message strong {
    font-weight: var(--font-weight-semibold);
}

.apple-activity-time {
    font-size: 0.7rem;
    color: var(--color-text-tertiary);
}

.apple-activity-action {
    align-self: center;
    flex-shrink: 0;
}

.apple-activity-action .apple-btn-ghost {
    padding: 4px 8px;
    font-size: 0.75rem;
}

/* ============================================== */
/* 6. COMMENTS SECTION */
/* ============================================== */

.apple-comments-section {
    background: var(--color-background-elevated);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

.apple-comment {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md) 0;
}

.apple-comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}

.apple-comment-body {
    flex: 1;
    min-width: 0;
}

.apple-comment-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.apple-comment-author {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-base);
    color: var(--color-text-primary);
}

.apple-comment-time {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
}

.apple-comment-content {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: var(--spacing-sm);
}

.apple-comment-actions {
    display: flex;
    gap: var(--spacing-md);
}

.apple-comment-action-btn {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.apple-comment-action-btn:hover {
    color: var(--color-primary);
}

/* Comment Reply (Indented) */
.apple-comment-reply {
    margin-left: calc(36px + var(--spacing-md));
    padding-top: var(--spacing-md);
    border-left: 2px solid var(--color-gray-lighter);
    padding-left: var(--spacing-md);
}

/* ============================================== */
/* 7. PRIORITY CARD (Morning Briefing) */
/* ============================================== */

.apple-priority-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
}

.apple-priority-card h2 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--spacing-lg);
}

.apple-priority-item {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    border-left: 4px solid rgba(255, 255, 255, 0.4);
}

.apple-priority-item:last-child {
    margin-bottom: 0;
}

.apple-priority-item.urgent {
    border-left-color: var(--color-danger);
    background: rgba(255, 59, 48, 0.2);
}

.apple-priority-item.warning {
    border-left-color: var(--color-warning);
    background: rgba(255, 149, 0, 0.2);
}

/* ============================================== */
/* 8. STAT CARDS (Apple-Style) */
/* ============================================== */

.apple-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.apple-stat-card {
    background: var(--color-background-elevated);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    border-top: 3px solid var(--color-primary);
}

.apple-stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.apple-stat-card.success {
    border-top-color: var(--color-success);
}

.apple-stat-card.warning {
    border-top-color: var(--color-warning);
}

.apple-stat-card.danger {
    border-top-color: var(--color-danger);
}

.apple-stat-icon {
    font-size: 24px;
    margin-bottom: var(--spacing-xs);
    display: block;
}

.apple-stat-value {
    font-size: 28px;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    line-height: 1;
    margin: var(--spacing-xs) 0;
}

.apple-stat-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: var(--font-weight-medium);
}

.apple-stat-change {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    margin-top: var(--spacing-xs);
}

.apple-stat-change.positive {
    color: var(--color-success);
}

.apple-stat-change.negative {
    color: var(--color-danger);
}

/* ============================================== */
/* 9. UTILITIES */
/* ============================================== */

/* 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); }

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

/* Text Colors */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.animate-fade-in {
    animation: fadeIn var(--transition-base) ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp var(--transition-slow) ease-out;
}

.animate-scale-in {
    animation: scaleIn var(--transition-base) ease-out;
}

/* Stagger Animation for Lists */
.animate-stagger > * {
    animation: fadeInUp var(--transition-slow) ease-out;
}

.animate-stagger > *:nth-child(1) { animation-delay: 0ms; }
.animate-stagger > *:nth-child(2) { animation-delay: 50ms; }
.animate-stagger > *:nth-child(3) { animation-delay: 100ms; }
.animate-stagger > *:nth-child(4) { animation-delay: 150ms; }
.animate-stagger > *:nth-child(5) { animation-delay: 200ms; }
.animate-stagger > *:nth-child(6) { animation-delay: 250ms; }
.animate-stagger > *:nth-child(7) { animation-delay: 300ms; }
.animate-stagger > *:nth-child(8) { animation-delay: 350ms; }

/* ============================================== */
/* 10. RESPONSIVE DESIGN */
/* ============================================== */

@media (max-width: 768px) {
    .apple-stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .apple-h1 {
        font-size: var(--font-size-xl);
    }

    .apple-h2 {
        font-size: var(--font-size-lg);
    }

    .apple-priority-card {
        padding: var(--spacing-lg);
    }
}

@media (max-width: 480px) {
    .apple-stat-grid {
        grid-template-columns: 1fr;
    }

    .apple-comment-reply {
        margin-left: var(--spacing-md);
    }
}

/* ============================================== */
/* 11. DARK MODE SUPPORT (Future) */
/* ============================================== */

@media (prefers-color-scheme: dark) {
    :root {
        --color-background: #000000;
        --color-background-elevated: #1C1C1E;
        --color-text-primary: #FFFFFF;
        --color-text-secondary: #EBEBF5;
        --color-text-tertiary: #8E8E93;
        --color-gray-lighter: #2C2C2E;
        --color-gray-light: #48484A;
    }

    .apple-card {
        background: var(--color-background-elevated);
    }

    .apple-btn-secondary {
        background: var(--color-gray-lighter);
        color: var(--color-text-primary);
    }
}
