/* BioLink System - Main Stylesheet */

/* ========================================
   CSS Variables & Root
   ======================================== */
:root {
    /* Primary Colors */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.1);

    /* Secondary Colors */
    --accent: #ec4899;
    --accent-hover: #db2777;

    /* Neutrals */
    --bg-dark: #0f0f23;
    --bg-card: #1a1a2e;
    --bg-elevated: #252541;
    --bg-hover: #2d2d4a;

    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b80;

    /* Borders */
    --border: #2d2d4a;
    --border-focus: #6366f1;

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
}

/* ========================================
   Reset & Base
   ======================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

ul,
ol {
    list-style: none;
}

/* ========================================
   Typography
   ======================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: 1rem;
}

h6 {
    font-size: 0.875rem;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   Layout Components
   ======================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.gap-xs {
    gap: var(--space-xs);
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.gap-lg {
    gap: var(--space-lg);
}

/* ========================================
   Card Component
   ======================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.card-header {
    margin-bottom: var(--space-lg);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ========================================
   Button Components
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-accent {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.btn-accent:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
}

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ========================================
   Form Components
   ======================================== */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input-icon {
    position: relative;
}

.form-input-icon .icon {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.form-input-icon .form-input {
    padding-left: calc(var(--space-md) * 2 + 16px);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a0a0b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    background-size: 16px;
    padding-right: calc(var(--space-md) * 2 + 16px);
}

.form-error {
    color: var(--error);
    font-size: 0.8125rem;
    margin-top: var(--space-xs);
}

.form-hint {
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-top: var(--space-xs);
}

/* Color Picker */
.color-picker {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    cursor: pointer;
    overflow: hidden;
}

.color-swatch input[type="color"] {
    width: 60px;
    height: 60px;
    margin: -10px;
    border: none;
    cursor: pointer;
}

/* ========================================
   Avatar Component
   ======================================== */
.avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    object-fit: cover;
    background: var(--bg-elevated);
}

.avatar-sm {
    width: 32px;
    height: 32px;
}

.avatar-lg {
    width: 64px;
    height: 64px;
}

.avatar-xl {
    width: 96px;
    height: 96px;
}

.avatar-2xl {
    width: 128px;
    height: 128px;
}

.avatar-wrapper {
    position: relative;
    display: inline-block;
}

.avatar-edit {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.avatar-edit:hover {
    background: var(--primary-hover);
}

/* ========================================
   Toggle Switch
   ======================================== */
.toggle {
    position: relative;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #374151;
    /* Darker off state */
    border-radius: var(--radius-full);
    transition: background 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
    /* Inner shadow for depth */
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 2px;
    background: white;
    border-radius: var(--radius-full);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle input:checked+.toggle-slider {
    background: var(--success);
    /* Green for success/active */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle input:checked+.toggle-slider:before {
    transform: translateX(24px);
}

.toggle:hover .toggle-slider:before {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
    /* Hover ring effect */
}

/* ========================================
   Tabs
   ======================================== */
.tabs {
    display: flex;
    gap: var(--space-xs);
    background: var(--bg-elevated);
    padding: var(--space-xs);
    border-radius: var(--radius-md);
}

.tab {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    text-align: center;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    background: var(--primary);
    color: white;
}

/* ========================================
   Modal
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-success {
    border-left: 3px solid var(--success);
}

.toast-error {
    border-left: 3px solid var(--error);
}

.toast-warning {
    border-left: 3px solid var(--warning);
}

.toast-icon {
    font-size: 1.25rem;
}

.toast-success .toast-icon {
    color: var(--success);
}

.toast-error .toast-icon {
    color: var(--error);
}

.toast-warning .toast-icon {
    color: var(--warning);
}

.toast-message {
    flex: 1;
    font-size: 0.9375rem;
}

.toast-close {
    color: var(--text-muted);
    padding: var(--space-xs);
}

.toast-close:hover {
    color: var(--text-primary);
}

/* ========================================
   Loading Spinner
   ======================================== */
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 35, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    z-index: 3000;
}

.loading-overlay .spinner {
    width: 48px;
    height: 48px;
    border-width: 3px;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.empty-state-text {
    font-size: 0.9375rem;
    margin-bottom: var(--space-lg);
}

/* ========================================
   Utilities
   ======================================== */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-secondary {
    color: var(--text-secondary);
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.mt-sm {
    margin-top: var(--space-sm);
}

.mt-md {
    margin-top: var(--space-md);
}

.mt-lg {
    margin-top: var(--space-lg);
}

.mb-sm {
    margin-bottom: var(--space-sm);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mb-lg {
    margin-bottom: var(--space-lg);
}

.hidden {
    display: none !important;
}

.invisible {
    visibility: hidden;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    :root {
        font-size: 15px;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .container {
        padding: 0 var(--space-sm);
    }

    .card {
        padding: var(--space-md);
    }

    .modal {
        width: 95%;
        max-height: 85vh;
    }

    .toast-container {
        left: var(--space-sm);
        right: var(--space-sm);
        bottom: var(--space-sm);
    }

    .toast {
        width: 100%;
    }
}