/**
 * Modern Social Platform - Main Styles (Refined)
 * Professional Design - Minimalist & Sophisticated
 * Supports Light & Dark Modes
 */

/* ============================================
   DESIGN TOKENS (CSS VARIABLES)
   ============================================ */

:root {
    /* Color Palette - Light Theme (Premium Indigo & Slate) */
    --brand-primary: #6366f1; /* Indigo 500 */
    --brand-primary-hover: #4f46e5; /* Indigo 600 */
    --brand-primary-light: #eef2ff; /* Indigo 50 */
    --brand-logo: #0f766e; /* Teal 700 */
    --brand-secondary: #64748b; /* Slate 500 */
    --brand-success: #10b981; /* Emerald 500 */
    --brand-danger: #f43f5e; /* Rose 500 */
    --brand-warning: #f59e0b; /* Amber 500 */
    --brand-info: #0ea5e9; /* Sky 500 */

    /* Neutrals - Sophisticated Slate Palette */
    --color-bg: #fdfdfd;
    --color-bg-card: #ffffff;
    --color-bg-alt: #f8fafc;
    --color-text: #0f172a;
    --color-text-light: #334155;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;

    /* Elevation & Depth - Soft, multi-layered shadows */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.04), 0 4px 6px -4px rgb(0 0 0 / 0.04);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.04), 0 8px 10px -6px rgb(0 0 0 / 0.04);

    /* Typography - Inter for UI, with tight tracking */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-serif: 'Georgia', serif;
    --font-mono: 'ui-monospace', 'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', monospace;

    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;

    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Spacing & Sizing - Linear scale */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Transitions - Snappy & smooth */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-index */
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-backdrop: 1040;
    --z-modal: 1050;
    --z-tooltip: 1070;
}

/* Dark Mode Overrides - Deep Midnight Theme */
@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #020617; /* Slate 950 */
        --color-bg-card: #0f172a; /* Slate 900 */
        --color-bg-alt: #1e293b; /* Slate 800 */
        --color-text: #f8fafc; /* Slate 50 */
        --color-text-light: #cbd5e1; /* Slate 300 */
        --color-text-muted: #64748b; /* Slate 500 */
        --color-border: #1e293b; /* Slate 800 */
        --color-border-light: #0f172a; /* Slate 900 */

        --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
        --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.6);
        --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.7);
        
        --brand-primary-light: rgba(99, 102, 241, 0.1);
    }
}

/* ============================================
   RESET & BASE
   ============================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    transition: background-color var(--transition-base), color var(--transition-base);
    min-height: 100vh;
}

a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: all var(--transition-fast);
}

a:hover {
    color: var(--brand-primary-hover);
}

ul, ol {
    list-style: none;
}

img, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

button, input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
    outline: none;
}

/* ============================================
   LAYOUT COMPONENTS
   ============================================ */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.section {
    padding: var(--spacing-2xl) 0;
}

/* ============================================
   UI COMPONENTS
   ============================================ */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: 0.625rem 1.25rem;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    white-space: nowrap;
    user-select: none;
    border: 1px solid transparent;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background-color: var(--brand-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--brand-primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--color-bg-alt);
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--color-border);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--color-border);
    color: var(--color-text);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background-color: var(--brand-primary-light);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: var(--font-size-xs);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-base);
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Cards */
.card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card-body {
    padding: var(--spacing-md);
}

.card-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--color-border-light);
}

.card-footer {
    padding: var(--spacing-md);
    border-top: 1px solid var(--color-border-light);
}

/* Form Controls */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-light);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-light);
}

.form-control::placeholder {
    color: var(--color-text-muted);
}

.form-control:disabled {
    background-color: var(--color-bg-alt);
    cursor: not-allowed;
}

/* Avatar */
.avatar {
    position: relative;
    display: inline-block;
    border-radius: var(--radius-full);
    overflow: hidden;
    background-color: var(--color-bg-alt);
    flex-shrink: 0;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-xs { width: 1.25rem; height: 1.25rem; }
.avatar-sm { width: 2rem; height: 2rem; }
.avatar-md { width: 2.5rem; height: 2.5rem; }
.avatar-lg { width: 3.5rem; height: 3.5rem; }
.avatar-xl { width: 6rem; height: 6rem; }

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-full);
    line-height: 1.25rem;
}

.badge-primary { background-color: var(--brand-primary-light); color: var(--brand-primary); }
.badge-success { background-color: #ecfdf5; color: var(--brand-success); }
.badge-danger { background-color: #fef2f2; color: var(--brand-danger); }

/* Alerts */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-sm);
}

.alert-success { background-color: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-danger { background-color: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Typography */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.text-muted { color: var(--color-text-muted); }
.text-light { color: var(--color-text-light); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

/* Spacing */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }

/* Flex */
.d-flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

/* Visibility */
.d-none { display: none; }
@media (min-width: 768px) {
    .d-md-block { display: block; }
    .d-md-flex { display: flex; }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn var(--transition-slow) forwards;
}

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

body.fade-in {
    animation: fadeInBody var(--transition-slow) forwards;
}
