@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --bg-main: #0b0813;
    --bg-surface: rgba(20, 15, 38, 0.6);
    --bg-surface-opaque: #140f26;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-glow: rgba(147, 51, 234, 0.3);
    
    --primary: hsl(271, 91%, 65%);
    --primary-glow: rgba(147, 51, 234, 0.45);
    --primary-hover: hsl(271, 91%, 72%);
    
    --text-primary: hsl(210, 20%, 98%);
    --text-secondary: hsl(210, 12%, 76%);
    --text-muted: hsl(210, 8%, 52%);
    
    --success: hsl(142, 76%, 45%);
    --danger: hsl(350, 89%, 60%);
    --warning: hsl(37, 95%, 55%);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-lg: 0 12px 48px 0 rgba(0, 0, 0, 0.5);
    
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 10% 20%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(168, 85, 247, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Glassmorphism panel base */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    border-radius: 16px;
    padding: 24px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
    border-color: var(--border-color-glow);
    box-shadow: 0 8px 32px 0 rgba(147, 51, 234, 0.1);
}

/* Auth Cards */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 30%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Inputs */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

select.form-control option {
    background-color: #140f26;
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Custom Multi-select Category Pills styling */
.categories-select-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.category-pill-checkbox {
    display: none;
}

.category-pill-label {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.category-pill-checkbox:checked + .category-pill-label {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px var(--primary-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-block {
    display: flex;
    width: 100%;
}

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

/* Alert Boxes */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fde047;
}

/* Layout - Sidebar Navigation Dashboard */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: rgba(13, 9, 28, 0.85);
    border-right: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 40%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    list-style: none;
    padding: 10px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-item a:hover,
.sidebar-item.active a {
    background: rgba(147, 51, 234, 0.12);
    color: #fff;
}

.sidebar-item.active a {
    border-left: 3px solid var(--primary);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-badge {
    font-size: 0.88rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-badge .indicator {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
}

.main-content {
    flex-grow: 1;
    margin-left: 260px;
    padding: 40px;
    width: calc(100% - 260px);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    display: flex;
    flex-direction: column;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    padding: 16px 20px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    color: var(--text-secondary);
    vertical-align: middle;
}

.custom-table tr:last-child td {
    border-bottom: none;
}

.custom-table tbody tr {
    transition: background-color 0.2s ease;
}

.custom-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Rank pill styles */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.rank-badge.green {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.rank-badge.red {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.rank-badge.orange {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-outline {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
}

.category-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(147, 51, 234, 0.15);
    color: #d8b4fe;
    border: 1px solid rgba(147, 51, 234, 0.3);
    margin-right: 4px;
    margin-bottom: 4px;
}

/* Details slide-out drawer or overlay card */
.details-drawer {
    position: fixed;
    top: 0;
    right: -550px;
    width: 500px;
    height: 100vh;
    background: var(--bg-surface-opaque);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.details-drawer.open {
    right: 0;
}

.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 999;
    display: none;
}

.drawer-backdrop.show {
    display: block;
}

.drawer-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-title h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
}

.drawer-title p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.close-drawer {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-drawer:hover {
    color: #fff;
}

.drawer-body {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* History logs inside drawer */
.history-logs-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-log-item {
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-log-meta {
    display: flex;
    flex-direction: column;
}

.history-log-date {
    font-size: 0.9rem;
    font-weight: 500;
}

.history-log-stamp {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Grid filters controls dashboard */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tabs */
.tab-container {
    margin-top: 20px;
}

.tab-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 16px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover,
.tab-btn.active {
    color: #fff;
}

.tab-btn.active {
    border-color: var(--primary);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Settings columns */
.settings-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 40px;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-nav-item {
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer;
    background: none;
    border: none;
    text-align: left;
}

.settings-nav-item:hover,
.settings-nav-item.active {
    background: rgba(147, 51, 234, 0.1);
    color: var(--primary);
}

/* Share Page specific spacing */
.share-wrapper {
    max-width: 800px;
    margin: 60px auto;
    padding: 0 20px;
}

.share-card-header {
    text-align: center;
    margin-bottom: 30px;
}

.share-card-header h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    margin-bottom: 6px;
}

/* Search suggestions suggest item research */
.research-suggestions-box {
    margin-top: 24px;
}

.research-item-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.research-item-row:last-child {
    border-bottom: none;
}

/* Inline checkbox styles */
.checkbox-custom {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.grecaptcha-badge {
    visibility: hidden;
}

/* Utilities */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }

.mb-3 { margin-bottom: 16px; }
.mt-3 { margin-top: 16px; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
