/* ============================================
   MOODLEBOX UBS - Design System
   Modern, Clean, Accessible
   ============================================ */

:root {
    /* Couleurs UBS */
    --ubs-blue: #002E5D;
    --ubs-blue-light: #1a4a7a;
    --ubs-yellow: #15769c;
    --ubs-yellow-light: #629bac;
    
    /* Neutrals */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    
    /* Semantic */
    --success: #059669;
    --success-bg: #d1fae5;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --info: #0284c7;
    --info-bg: #e0f2fe;
    
    /* Docsify Themeable Overrides */
    --base-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --base-font-size: 16px;
    --base-line-height: 1.7;
    --base-color: var(--gray-700);
    
    --theme-color: var(--ubs-blue);
    
    --heading-color: var(--gray-900);
    --heading-h1-font-size: 2rem;
    --heading-h2-font-size: 1.5rem;
    --heading-h2-border-color: var(--gray-200);
    
    --link-color: var(--ubs-blue);
    --link-color--hover: var(--ubs-blue-light);
    
    --sidebar-width: 260px;
    --sidebar-background: var(--gray-50);
    --sidebar-border-color: var(--gray-200);
    --sidebar-nav-link-color: var(--gray-700);
    --sidebar-nav-link-color--active: var(--ubs-blue);
    --sidebar-nav-link-font-weight--active: 600;
    
    --code-inline-background: var(--gray-100);
    --code-inline-color: var(--ubs-blue);
    
    --blockquote-border-color: var(--ubs-blue);
    --blockquote-background: var(--gray-50);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

.markdown-section h1 {
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-top: 0;
}

.markdown-section h2 {
    font-weight: 600;
    margin-top: 2.5rem;
    padding-bottom: 0.5rem;
}

.markdown-section h3 {
    font-weight: 600;
    color: var(--gray-700);
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    border-right: 1px solid var(--gray-200);
}

.sidebar-nav li.active > a {
    color: var(--ubs-blue);
    font-weight: 600;
    background: white;
    margin: 0 8px;
}

.app-name-link {
    font-weight: 700 !important;
    color: var(--ubs-blue) !important;
    font-size: 1.1rem !important;
}

/* ============================================
   LINKS
   ============================================ */

.markdown-section a {
    text-decoration: none;
    border-bottom: 1px solid var(--gray-200);
    transition: border-color 0.2s;
}

.markdown-section a:hover {
    border-color: var(--ubs-yellow);
}

/* Focus visible for accessibility */
a:focus-visible {
    outline: 2px solid var(--ubs-yellow);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ============================================
   TABLES
   ============================================ */

.markdown-section table {
    display: table;
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.markdown-section table th {
    background: var(--ubs-blue);
    color: white;
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
}

.markdown-section table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.markdown-section table tr:hover {
    background: var(--gray-50);
}

/* ============================================
   CODE
   ============================================ */

.markdown-section code {
    font-family: 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.875em;
    padding: 0.2em 0.4em;
    border-radius: 4px;
}

.markdown-section pre {
    background: var(--gray-900);
    border-radius: 8px;
    padding: 1rem;
}

.markdown-section pre code {
    color: #e5e7eb;
    background: transparent;
    padding: 0;
}

/* ============================================
   ALERTS (Docsify Tips/Warnings)
   ============================================ */

/* Info tip: ?> */
.markdown-section p.tip {
    position: relative;
    background: var(--info-bg);
    border-left: 4px solid var(--info);
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.25rem 1rem 3rem;
    margin: 1.5rem 0;
}

.markdown-section p.tip::before {
    content: "ℹ️";
    position: absolute;
    left: 1rem;
    top: 1rem;
    background: none !important;
    width: auto !important;
    height: auto !important;
    font-size: 1rem;
    line-height: 1;
}

/* Warning: !> */
.markdown-section p.warn {
    position: relative;
    background: var(--warning-bg);
    border-left: 4px solid var(--warning);
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.25rem 1rem 3rem;
    margin: 1.5rem 0;
}

.markdown-section p.warn::before {
    content: "⚠️";
    position: absolute;
    left: 1rem;
    top: 1rem;
    background: none !important;
    width: auto !important;
    height: auto !important;
    font-size: 1rem;
    line-height: 1;
}

/* ============================================
   CUSTOM COMPONENTS
   ============================================ */

/* Quick Reference Box */
.quick-ref {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.quick-ref-title {
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 1rem;
}

.quick-ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.quick-ref-item {
    background: var(--gray-50);
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

.quick-ref-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}

.quick-ref-value {
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ubs-blue);
}

/* Profile Cards */
.profile-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.profile-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    text-decoration: none !important;
    transition: all 0.2s;
    display: block;
}

.profile-card:hover {
    border-color: var(--ubs-blue);
    box-shadow: 0 4px 12px rgba(0,46,93,0.1);
    transform: translateY(-2px);
}

.profile-card-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.profile-card-title {
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.profile-card-desc {
    font-size: 0.875rem;
    color: var(--gray-500);
    line-height: 1.5;
}

/* Steps */
.steps {
    counter-reset: step;
    list-style: none !important;
    padding-left: 0 !important;
    margin: 1.5rem 0;
}

.steps li {
    counter-increment: step;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-radius: 8px;
}

.steps li::before {
    content: counter(step);
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: var(--ubs-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

/* LED Indicators */
.led {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.led-red { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.led-green { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.led-off { background: #9ca3af; }

/* Keyboard shortcuts */
kbd {
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    padding: 0.1em 0.4em;
    font-family: inherit;
    font-size: 0.875em;
    box-shadow: 0 1px 0 var(--gray-300);
}

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

@media (max-width: 768px) {
    .profile-cards {
        grid-template-columns: 1fr;
    }
    
    .quick-ref-grid {
        grid-template-columns: 1fr 1fr;
    }
}

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

@media print {
    .sidebar, .sidebar-toggle {
        display: none !important;
    }
    
    .content {
        margin-left: 0 !important;
    }
    
    .markdown-section {
        max-width: 100% !important;
    }
}

.btn-print {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--ubs-blue);
    color: white !important;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.70rem;
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 100;
    transition: all 0.2s;
}

.btn-print:hover {
    background: var(--ubs-blue-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

@media print {
    .btn-print {
        display: none !important;
    }
}

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

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode improvements */
@media (prefers-contrast: high) {
    :root {
        --gray-500: #4b5563;
        --gray-700: #1f2937;
    }
}
