/* --- RESET & BASE --- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body { 
    margin: 0; 
    padding: 0; 
    font-family: var(--font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif); 
    line-height: 1.5; 
    color: var(--text-main, #1f2937); 
    background-color: var(--light, #f9fafb); 
}
h1, h2, h3, h4, h5, h6 { margin-top: 0; margin-bottom: 0.5rem; font-weight: 700; line-height: 1.2; }
a { text-decoration: none; color: inherit; transition: color 0.2s; }
img { max-width: 100%; height: auto; display: block; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

/* --- LAYOUT & CONTAINERS --- */
.app-container { min-height: calc(100vh - 60px); display: flex; flex-direction: column; }
.container { width: 100%; margin-left: auto; margin-right: auto; padding-left: 1.5rem; padding-right: 1.5rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 48rem; }
.max-w-xl { max-width: 64rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.min-h-screen { min-height: 100vh; }

/* --- FLEXBOX & GRID UTILITIES --- */
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1 1 0%; }

.grid { display: grid; }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }
.gap-5 { gap: 3rem; }

/* --- SPACING (MARGIN & PADDING) --- */
.m-0 { margin: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.p-0 { padding: 0 !important; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }
.px-5 { padding-left: 3rem; padding-right: 3rem; }
.py-5 { padding-top: 3rem; padding-bottom: 3rem; }

/* --- TYPOGRAPHY --- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-sm { font-size: 0.875rem; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--text-muted, #6b7280); }
.opacity-80 { opacity: 0.8; }

/* --- SIZING --- */
.w-100 { width: 100%; }
.min-w-300 { min-width: 300px; }
.size-12 { width: 12px; height: 12px; }
.size-64 { width: 64px; height: 64px; }
.size-128 { width: 128px; height: 128px; }
.size-256 { width: 256px; height: 256px; }

/* --- BORDERS & RADIUS --- */
.border { border: 1px solid var(--border-color, #e5e7eb); }
.border-bottom { border-bottom: 1px solid var(--border-color, #e5e7eb); }
.border-0 { border: none !important; }
.rounded { border-radius: 0.375rem; }
.rounded-xl { border-radius: 1rem; }
.rounded-circle, .circle { border-radius: 50%; }

/* --- UI COMPONENTS --- */
.badge { 
    display: inline-block; 
    padding: 0.25rem 0.75rem; 
    font-size: 0.875rem; 
    font-weight: 600; 
    border-radius: 9999px; 
}

.card { 
    background-color: var(--white, #ffffff); 
    border-radius: var(--border-radius-lg, 1rem); 
    border: 1px solid var(--border-color, #e5e7eb); 
    overflow: hidden; 
}

.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }

.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }

/* --- NAVIGATION BAR --- */
.main-navbar { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 1rem 2rem; 
    background-color: var(--white, #ffffff); 
    border-bottom: 1px solid var(--border-color, #e5e7eb); 
}
.nav-brand a { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.25rem; }
.nav-brand img.logo { height: 32px; width: 32px; }
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-item { font-weight: 500; color: var(--secondary, #6b7280); }
.nav-item:hover { color: var(--primary, #4f46e5); }

/* --- BUTTONS --- */
.btn { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    padding: 0.5rem 1rem; 
    font-weight: 500; 
    border-radius: var(--border-radius, 0.5rem); 
    border: 1px solid transparent; 
    cursor: pointer; 
    transition: all 0.2s; 
    text-decoration: none; 
}
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1.125rem; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.875rem; }

/* Colors inherited from themes.css */
.btn-primary { background-color: var(--primary, #4f46e5); color: #fff; }
.btn-primary:hover { background-color: var(--primary-hover, #4338ca); transform: translateY(-1px); }
.btn-outline-secondary { background-color: transparent; border-color: #d1d5db; color: #374151; }
.btn-outline-secondary:hover { background-color: #f3f4f6; }
.btn-light { background-color: #fff; color: var(--primary, #4f46e5); }
.btn-light:hover { background-color: #f9fafb; }
.btn-danger { background-color: var(--danger, #ef4444); color: #fff; }

/* --- FORMS --- */
.form-group { margin-bottom: 1rem; text-align: left; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: #374151; }
.form-control { 
    width: 100%; 
    padding: 0.5rem 0.75rem; 
    border: 1px solid #d1d5db; 
    border-radius: var(--border-radius, 0.5rem); 
    font-size: 1rem; 
    transition: all 0.2s; 
}
.form-control:focus { 
    outline: none; 
    border-color: var(--primary, #4f46e5); 
    box-shadow: 0 0 0 3px var(--primary-light, #e0e7ff); 
}

/* --- ALERTS & MESSAGES --- */
.alert { padding: 1rem; border-radius: var(--border-radius, 0.5rem); margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background-color: var(--success-light, #d1fae5); border-color: #34d399; color: #065f46; }
.alert-danger { background-color: var(--danger-light, #fee2e2); border-color: #f87171; color: #991b1b; }

/* --- LISTS --- */
ul.check-list { list-style: none; padding: 0; margin: 0; }
ul.check-list li { margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }

/* --- MODALS (For Cropper) --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 50; padding: 1rem;
}
.modal-content {
    width: 100%; max-width: 500px; max-height: 90vh;
    display: flex; flex-direction: column;
}
/* =========================================================
   MISSING UI COMPONENTS (Auth, Cards, Tables, Dropzone) 
   ========================================================= */

/* --- AUTHENTICATION VIEWS --- */
.auth-wrapper {
    min-height: calc(100vh - 80px); /* Account for navbar */
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.auth-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    display: block;
}

/* --- CARD INTERNALS --- */
.card-header {
    padding: 1.5rem;
    background-color: var(--light, #f9fafb);
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1.5rem;
    background-color: var(--light, #f9fafb);
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.card-header h2, .card-header h3 {
    margin: 0;
}

/* --- PROFILE & DASHBOARD --- */
.public-profile-container {
    padding: 4rem 1rem;
}

.bio-box {
    background-color: var(--light, #f9fafb);
    border: 1px solid var(--border-color, #e5e7eb);
    padding: 1rem;
    border-radius: var(--border-radius, 0.5rem);
    color: var(--text-main);
    font-size: 0.95rem;
}

.avatar-preview-wrapper img {
    margin: 0 auto;
    border: 4px solid var(--white, #ffffff);
}

/* --- UPLOAD DROPZONE --- */
.upload-dropzone {
    border: 2px dashed var(--border-color, #d1d5db);
    border-radius: var(--border-radius-lg, 1rem);
    padding: 3rem 1.5rem;
    background-color: var(--light, #f9fafb);
    transition: all var(--transition-speed, 0.2s) ease;
}

.upload-dropzone:hover, 
.upload-dropzone.dragover {
    border-color: var(--primary, #4f46e5);
    background-color: var(--primary-light, #e0e7ff);
}

.hidden-file-input {
    display: none; /* Hides the ugly default HTML file input */
}

.cursor-pointer {
    cursor: pointer;
}

/* --- TABLES (Settings / API Keys) --- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th, 
.table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    vertical-align: middle;
}

.table th {
    background-color: var(--light, #f9fafb);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #6b7280);
    font-weight: 600;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background-color: var(--light, #f9fafb);
}

/* --- PROGRESS BARS (API Usage) --- */
.progress-bar-bg {
    width: 100%;
    height: 0.5rem;
    background-color: var(--border-color, #e5e7eb);
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--primary, #4f46e5);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* --- MISC FIXES --- */
.inline-form {
    display: inline;
}

.alert ul {
    margin: 0;
    padding-left: 1.5rem;
}