/* =============================================================================
   CSS v2 UTILITIES
   Reusable utility classes to replace common inline styles.
   ============================================================================= */

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

/* -----------------------------------------------------------------------------
   Flexbox
   ----------------------------------------------------------------------------- */
.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }

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

.flex-1 { flex: 1 1 0%; }
.flex-auto { flex: 1 1 auto; }
.flex-none { flex: none; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-grow { flex-grow: 1; }

/* -----------------------------------------------------------------------------
   Gap (Flexbox & Grid)
   ----------------------------------------------------------------------------- */
.gap-0 { gap: 0; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* -----------------------------------------------------------------------------
   Spacing: Margin
   ----------------------------------------------------------------------------- */
.m-0 { margin: 0; }
.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); }
.m-auto { margin: auto; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.ml-0 { margin-left: 0; }
.ml-1 { margin-left: var(--space-1); }
.ml-2 { margin-left: var(--space-2); }
.ml-3 { margin-left: var(--space-3); }
.ml-4 { margin-left: var(--space-4); }
.ml-auto { margin-left: auto; }

.mr-0 { margin-right: 0; }
.mr-1 { margin-right: var(--space-1); }
.mr-2 { margin-right: var(--space-2); }
.mr-3 { margin-right: var(--space-3); }
.mr-4 { margin-right: var(--space-4); }
.mr-auto { margin-right: auto; }

.mx-auto { margin-left: auto; margin-right: auto; }

/* -----------------------------------------------------------------------------
   Spacing: Padding
   ----------------------------------------------------------------------------- */
.p-0 { padding: 0; }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.pt-0 { padding-top: 0; }
.pt-2 { padding-top: var(--space-2); }
.pt-4 { padding-top: var(--space-4); }
.pt-6 { padding-top: var(--space-6); }

.pb-0 { padding-bottom: 0; }
.pb-2 { padding-bottom: var(--space-2); }
.pb-4 { padding-bottom: var(--space-4); }
.pb-6 { padding-bottom: var(--space-6); }

.px-2 { padding-left: var(--space-2); padding-right: var(--space-2); }
.px-3 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }

.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }

/* -----------------------------------------------------------------------------
   Icon Sizes (Solves ~100+ inline styles)
   ----------------------------------------------------------------------------- */
.icon-xs { width: 12px; height: 12px; font-size: var(--text-xs); }
.icon-sm { width: 14px; height: 14px; font-size: var(--text-sm); }
.icon-md { width: 16px; height: 16px; font-size: var(--text-base); }
.icon-base { width: 18px; height: 18px; font-size: var(--text-lg); }
.icon-lg { width: 20px; height: 20px; font-size: var(--text-xl); }
.icon-xl { width: 24px; height: 24px; font-size: var(--text-2xl); }
.icon-2xl { width: 32px; height: 32px; font-size: var(--text-4xl); }
.icon-3xl { width: 40px; height: 40px; font-size: 40px; }
.icon-4xl { width: 48px; height: 48px; font-size: 48px; }

/* Icon within text (inline) */
.icon-inline {
    display: inline-block;
    vertical-align: middle;
    width: 1em;
    height: 1em;
}

/* Inline icons with specific sizes and margin */
.icon-inline-base {
    display: inline;
    vertical-align: middle;
    width: 18px;
    height: 18px;
    margin-right: 6px;
}

.icon-inline-lg {
    display: inline;
    vertical-align: middle;
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

.icon-inline-sm {
    display: inline-block;
    vertical-align: middle;
    width: 14px;
    height: 14px;
    margin-right: 6px;
}

/* -----------------------------------------------------------------------------
   Width & Height
   ----------------------------------------------------------------------------- */
.w-full { width: 100%; }
.w-auto { width: auto; }
.w-fit { width: fit-content; }
.h-full { height: 100%; }
.h-auto { height: auto; }
.h-screen { height: 100vh; }

.min-w-0 { min-width: 0; }
.max-w-full { max-width: 100%; }
.max-w-screen { max-width: 100%; }

/* Object Fit */
.object-cover { object-fit: cover; }
.object-contain { object-fit: contain; }
.object-fill { object-fit: fill; }

/* -----------------------------------------------------------------------------
   Text
   ----------------------------------------------------------------------------- */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }

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

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-primary); }
.text-success { color: var(--status-success); }
.text-warning { color: var(--status-warning); }
.text-error { color: var(--status-error); }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* -----------------------------------------------------------------------------
   Backgrounds
   ----------------------------------------------------------------------------- */
.bg-transparent { background: transparent; }
.bg-app { background: var(--surface-app); }
.bg-primary { background: var(--surface-primary); }
.bg-secondary { background: var(--surface-secondary); }
.bg-tertiary { background: var(--surface-tertiary); }
.bg-card { background: var(--surface-card); }

/* -----------------------------------------------------------------------------
   Borders
   ----------------------------------------------------------------------------- */
.border { border: 1px solid var(--border-default); }
.border-0 { border: none; }
.border-t { border-top: 1px solid var(--border-default); }
.border-b { border-bottom: 1px solid var(--border-default); }
.border-subtle { border-color: var(--border-subtle); }

.rounded-none { border-radius: 0; }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

/* -----------------------------------------------------------------------------
   Position
   ----------------------------------------------------------------------------- */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.inset-0 { inset: 0; }
.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }

/* -----------------------------------------------------------------------------
   Z-Index
   ----------------------------------------------------------------------------- */
.z-behind { z-index: var(--z-behind); }
.z-base { z-index: var(--z-base); }
.z-dropdown { z-index: var(--z-dropdown); }
.z-sticky { z-index: var(--z-sticky); }
.z-overlay { z-index: var(--z-overlay); }
.z-modal { z-index: var(--z-modal); }
.z-toast { z-index: var(--z-toast); }
.z-fab { z-index: var(--z-fab); }

/* -----------------------------------------------------------------------------
   Overflow
   ----------------------------------------------------------------------------- */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.overflow-visible { overflow: visible; }

/* -----------------------------------------------------------------------------
   Opacity
   ----------------------------------------------------------------------------- */
.opacity-0 { opacity: 0; }
.opacity-25 { opacity: 0.25; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* -----------------------------------------------------------------------------
   Cursor
   ----------------------------------------------------------------------------- */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }

/* -----------------------------------------------------------------------------
   Pointer Events
   ----------------------------------------------------------------------------- */
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }

/* -----------------------------------------------------------------------------
   Transitions
   ----------------------------------------------------------------------------- */
.transition-none { transition: none; }
.transition-all { transition: all var(--duration-normal) var(--ease-default); }
.transition-colors { transition: color var(--duration-normal) var(--ease-default), background-color var(--duration-normal) var(--ease-default), border-color var(--duration-normal) var(--ease-default); }
.transition-opacity { transition: opacity var(--duration-normal) var(--ease-default); }
.transition-transform { transition: transform var(--duration-normal) var(--ease-default); }

/* -----------------------------------------------------------------------------
   Animations
   ----------------------------------------------------------------------------- */
.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-bounce {
    animation: bounce 1s infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(-5%); }
    50% { transform: translateY(0); }
}

/* =============================================================================
   BUTTON SYSTEM
   Consistent button styling across all pages.

   BRAND COLORS:
   - Primary: Bright Cyan var(--color-cyan-500) (--accent-primary / --color-cyan-500)
   - Gradient: Cyan to Teal (var(--color-cyan-500) → var(--color-cyan-700))
   - Hover: Lift + Glow effect
   ============================================================================= */

/* Base Button Reset */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    line-height: 1;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* -----------------------------------------------------------------------------
   LEGACY BUTTON VARIANTS — REMOVED
   Migrated to design-system .ds-btn system (ds-btn--primary, ds-btn--secondary, etc.)
   Old classes: .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-danger
   ----------------------------------------------------------------------------- */

/* -----------------------------------------------------------------------------
   BUTTON SIZES
   ----------------------------------------------------------------------------- */
.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
}

.btn-xl {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    border-radius: var(--radius-lg);
    letter-spacing: 0.5px;
}

/* -----------------------------------------------------------------------------
   BUTTON MODIFIERS
   ----------------------------------------------------------------------------- */
.btn-block {
    display: flex;
    width: 100%;
}

.btn-icon {
    padding: var(--space-2);
    border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
    padding: var(--space-1);
}

.btn-icon.btn-lg {
    padding: var(--space-3);
}

/* Icon inside button */
.btn svg,
.btn i {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}
