/**
 * Nebula Theme - Base Styles
 * Modern CSS Foundation v3.0
 * Based on 2024/2025 Consumer Web Design Standards
 */

/* ============================
   Modern CSS Reset
   ============================ */

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

/* ============================
   Body - Modern Typography
   ============================ */

body {
    font-family: var(--nebula-font-sans, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
}

/* ============================
   Typography - Enhanced Scale
   ============================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--nebula-font-heading, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    color: var(--text-primary);
    letter-spacing: var(--tracking-tight);
}

h1 {
    font-size: var(--text-4xl);
    letter-spacing: var(--tracking-tighter);
}

h2 {
    font-size: var(--text-3xl);
    letter-spacing: var(--tracking-tight);
}

h3 {
    font-size: var(--text-2xl);
}

h4 {
    font-size: var(--text-xl);
}

h5 {
    font-size: var(--text-lg);
}

h6 {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
}

p {
    margin: 0 0 var(--space-4);
    line-height: var(--leading-relaxed);
    color: var(--text-secondary);
}

a {
    color: var(--primary-500);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

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

/* ============================
   Container - Modern Layout
   ============================ */

.nebula-container,
.container {
    width: 100%;
    max-width: var(--nebula-container-max);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

@media (min-width: 768px) {
    .nebula-container,
    .container {
        padding: 0 var(--space-6);
    }
}

/* ============================
   Cards - Modern Style
   ============================ */

.nebula-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-primary);
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-out);
}

.nebula-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-200);
}

.nebula-card-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-primary);
}

.nebula-card-body {
    padding: var(--space-6);
}

.nebula-card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-primary);
    background: var(--bg-secondary);
}

/* ============================
   Buttons - Modern Style
   ============================ */

.nebula-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    transition: all var(--duration-fast) var(--ease-out);
}

.nebula-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary Button */
.nebula-btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: #fff;
    box-shadow: var(--shadow-primary-sm);
}

.nebula-btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    transform: translateY(-1px);
    box-shadow: var(--shadow-primary);
    color: #fff;
}

.nebula-btn-primary:active {
    transform: translateY(0);
}

/* Secondary Button */
.nebula-btn-secondary {
    background: var(--neutral-800);
    color: #fff;
}

.nebula-btn-secondary:hover {
    background: var(--neutral-900);
    transform: translateY(-1px);
    color: #fff;
}

/* Outline Button */
.nebula-btn-outline {
    background: transparent;
    border-color: var(--border-primary);
    color: var(--text-primary);
}

.nebula-btn-outline:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-500);
    color: var(--primary-600);
}

/* Ghost Button */
.nebula-btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.nebula-btn-ghost:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Button Sizes */
.nebula-btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    border-radius: var(--radius-md);
}

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

/* ============================
   Forms - Modern Style
   ============================ */

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
textarea,
select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: inherit;
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    transition: all var(--duration-fast) var(--ease-out);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

/* ============================
   Tags - Modern Style
   ============================ */

.nebula-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    line-height: 1;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-full);
    transition: all var(--duration-fast) var(--ease-out);
}

.nebula-tag:hover {
    background: var(--primary-50);
    border-color: var(--primary-200);
    color: var(--primary-600);
}

.nebula-tag-primary {
    background: var(--primary-50);
    border-color: var(--primary-200);
    color: var(--primary-600);
}

.nebula-tag-accent {
    background: var(--warning-50);
    border-color: var(--warning-200);
    color: var(--warning-600);
}

/* ============================
   Modern Utilities
   ============================ */

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

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

/* Background Colors */
.bg-primary { background-color: var(--primary-500); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-success { background-color: var(--success-50); }
.bg-warning { background-color: var(--warning-50); }
.bg-error { background-color: var(--error-50); }
.bg-inverse { background-color: var(--bg-inverse); }

/* Border Radius */
.rounded-none { border-radius: 0; }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded { 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); }

/* Shadows */
.shadow-xs { box-shadow: var(--shadow-xs); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.shadow-primary { box-shadow: var(--shadow-primary); }
.shadow-inner { box-shadow: var(--shadow-inner); }

/* ============================
   Typography Utilities
   ============================ */

.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); }
.text-4xl { font-size: var(--text-4xl); }
.text-5xl { font-size: var(--text-5xl); }

.font-thin { font-weight: var(--font-thin); }
.font-light { font-weight: var(--font-light); }
.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); }
.font-extrabold { font-weight: var(--font-extrabold); }

.leading-none { line-height: var(--leading-none); }
.leading-tight { line-height: var(--leading-tight); }
.leading-snug { line-height: var(--leading-snug); }
.leading-normal { line-height: var(--leading-normal); }
.leading-relaxed { line-height: var(--leading-relaxed); }
.leading-loose { line-height: var(--leading-loose); }

.tracking-tighter { letter-spacing: var(--tracking-tighter); }
.tracking-tight { letter-spacing: var(--tracking-tight); }
.tracking-normal { letter-spacing: var(--tracking-normal); }
.tracking-wide { letter-spacing: var(--tracking-wide); }
.tracking-wider { letter-spacing: var(--tracking-wider); }

/* ============================
   Flexbox Utilities
   ============================ */

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.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-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ============================
   Grid Utilities
   ============================ */

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================
   Spacing Utilities
   ============================ */

.m-0 { margin: 0; }
.m-auto { margin: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }
.my-auto { margin-top: auto; margin-bottom: auto; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

/* ============================
   Visibility
   ============================ */

.hidden { display: none; }
.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;
}

/* ============================
   Interactive Utilities
   ============================ */

.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }
.pointer-events-none { pointer-events: none; }

/* ============================
   Overflow
   ============================ */

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* ============================
   Position
   ============================ */

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

/* ============================
   Width & Height
   ============================ */

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* ============================
   Transition Utilities
   ============================ */

.transition-none { transition: none; }
.transition-all { transition: all var(--duration-normal) var(--ease-out); }
.transition-colors { transition: color var(--duration-fast), background-color var(--duration-fast), border-color var(--duration-fast); }
.transition-transform { transition: transform var(--duration-fast) var(--ease-out); }
.transition-shadow { transition: box-shadow var(--duration-fast) var(--ease-out); }

/* ============================
   Animation Utilities
   ============================ */

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

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

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

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

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

@keyframes bounce {
    0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
    50% { transform: translateY(0); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
}

/* ============================
   Backdrop Blur (Glassmorphism)
   ============================ */

.backdrop-blur-sm { backdrop-filter: blur(var(--blur-sm)); }
.backdrop-blur-md { backdrop-filter: blur(var(--blur-md)); }
.backdrop-blur-lg { backdrop-filter: blur(var(--blur-lg)); }
.backdrop-blur-xl { backdrop-filter: blur(var(--blur-xl)); }

/* ============================
   Gradient Text
   ============================ */

.text-gradient-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gradient-accent {
    background: linear-gradient(135deg, var(--warning-400), var(--warning-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================
   Responsive Utilities
   ============================ */

@media (max-width: 767px) {
    .md\:hidden { display: none; }
    .md\:flex { display: flex; }
}

@media (min-width: 768px) {
    .md\:block { display: block; }
    .md\:flex { display: flex; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}
