/* Premium Modern Theme */
:root {
    /* Core Palette */
    --bg-body: #0a0a0a;
    --bg-card: #111111;
    --bg-card-hover: #161616;
    --bg-input: #1a1a1a;

    /* Accents */
    --primary: #3b82f6;
    /* Modern Blue */
    --primary-hover: #2563eb;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);

    /* Text */
    --text-main: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    /* Borders */
    --border-color: #27272a;
    --border-hover: #3f3f46;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
    /* Prevent layout shift when scrollbar appears */
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-sans);
    margin: 0;
    padding-bottom: 60px;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    color: var(--text-main);
}

h1 {
    font-size: 3rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
}

/* Navbar */
.navbar {
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    /* Vertical padding only, horizontal handled by container */
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
}

.navbar-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.03em;
    color: var(--text-main) !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-main) !important;
}

/* Layout Container */
.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
    background: var(--bg-card-hover);
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 20px;
    min-height: 42px;
    line-height: 1.2;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    vertical-align: middle;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.btn-outline-light {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline-light:hover {
    background: var(--bg-input);
    border-color: var(--text-secondary);
}

.btn-secondary,
.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-danger,
.btn-outline-success {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-main);
}

.btn-secondary {
    background: var(--bg-input);
}

.btn-secondary:hover,
.btn-outline-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-main);
    border-color: var(--text-secondary);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: rgba(59, 130, 246, 0.45);
}

.btn-outline-primary:hover {
    background: rgba(59, 130, 246, 0.14);
    color: #fff;
    border-color: var(--primary);
}

.btn-success {
    background: #16a34a;
    color: #fff;
}

.btn-danger,
.btn-outline-danger:hover {
    background: #dc2626;
    color: #fff;
}

.btn-outline-danger {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.45);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Forms */
.form-control {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    background: var(--bg-card);
}

label,
.form-label {
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 8px;
}

.text-muted {
    color: var(--text-secondary) !important;
}

.bg-light {
    background: var(--bg-card) !important;
    color: var(--text-main) !important;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

.page-header h1,
.page-header h2 {
    margin-bottom: 6px;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.page-subtitle {
    color: var(--text-secondary);
    margin: 0;
}

.table {
    color: var(--text-main);
    border-color: var(--border-color);
}

.table > :not(caption) > * > * {
    background: transparent;
    color: var(--text-main);
    border-bottom-color: var(--border-color);
}

.table thead th {
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-color);
}

.table-hover > tbody > tr:hover > * {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-main);
}

.table-danger > * {
    background: rgba(220, 38, 38, 0.12) !important;
}

.modal-content {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.modal-header,
.modal-footer {
    border-color: var(--border-color);
}

.modal-header.bg-danger {
    background: rgba(220, 38, 38, 0.18) !important;
    color: var(--text-main) !important;
}

.btn-close {
    filter: invert(1) grayscale(100%);
    opacity: 0.8;
}

.list-group-item {
    background: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border-color);
}

.list-group-item-action:hover {
    background: var(--bg-card-hover);
    color: var(--text-main);
}

.list-group-item-info {
    background: rgba(59, 130, 246, 0.10);
    color: var(--text-main);
}

.nav-tabs {
    border-bottom: 1px solid var(--border-color);
}

.nav-tabs .nav-link {
    color: var(--text-secondary) !important;
    border: 1px solid transparent;
    border-radius: 10px 10px 0 0;
}

.nav-tabs .nav-link:hover {
    border-color: var(--border-color);
}

.nav-tabs .nav-link.active {
    background: var(--bg-card);
    border-color: var(--border-color) var(--border-color) var(--bg-card);
    color: var(--text-main) !important;
}

.input-group-text {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

/* Avatars */
.avatar-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.avatar-small {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-skill {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Hero Section */
.hero-section,
.hero {
    text-align: center;
    padding: 80px 20px;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    max-width: 800px;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

/* Stats */
.stat-card {
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Skill Preview */
.skill-preview-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 16px;
    background: var(--bg-input);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    background: var(--bg-body);
}

/* Auth Pages (Login/Register) */
.auth-container {
    max-width: 400px;
    margin: 60px auto;
}

.auth-link {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 500;
}

.auth-link:hover {
    color: var(--primary-hover);
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
}

/* Search Form */
.search-form {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 40px;
}

.search-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.search-grid-single {
    grid-template-columns: minmax(260px, 1fr);
}

.search-full {
    width: 100%;
    margin-bottom: 20px;
}

select.form-control,
select.form-select {
    appearance: none;
    color-scheme: dark;
    min-height: 50px;
    background-color: var(--bg-input);
    color: var(--text-main);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23a1a1aa' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

select.form-control option,
select.form-select option {
    background-color: #18181b;
    color: #f4f4f5;
}

select.form-control option:checked,
select.form-select option:checked {
    background-color: var(--primary);
    color: #ffffff;
}

select.form-control option:disabled,
select.form-select option:disabled {
    color: var(--text-muted);
}

.search-btn {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
}

.advanced-filters-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 100%;
    margin-top: 10px;
}

.advanced-filters-btn:hover {
    background: var(--bg-input);
    color: var(--text-main);
}

/* Popular Skills Links */
.badge-skill a {
    color: var(--primary) !important;
    text-decoration: none;
}

/* User Card (Search Result) */
.user-card {
    background: #161616;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.user-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: var(--border-hover);
}

.user-card-avatar {
    flex-shrink: 0;
}

.user-card-content {
    flex-grow: 1;
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.user-card-username {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
}

.user-card-username:hover {
    color: var(--primary);
}

.user-card-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-badge {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.user-card-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 12px;
    line-height: 1.4;
}

.user-card-skill {
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.user-card-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

/* Popular Skills Grid */
.popular-skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.skill-card {
    position: relative;
    aspect-ratio: 16/9;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    background: #222;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    display: block;
}

.skill-card:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
    z-index: 1;
}

.skill-card-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.skill-card:hover .skill-card-bg {
    transform: scale(1.1);
}

.skill-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    box-sizing: border-box;
}

.skill-card-title {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    margin: 0;
}

.skill-card-count {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
    border-radius: 4px;
}

/* User-Centric Recommendation Cards */
.recommendation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.recommendation-card {
    background: #161616;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.recommendation-card:hover {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
}

.skill-modal-dialog {
    width: min(600px, calc(100% - 32px));
    margin: 50px auto;
}

.skill-modal-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(140px, auto);
    gap: 12px;
}

.skill-modal-actions .btn {
    width: 100%;
    min-height: 48px;
    white-space: normal;
}

.recommendation-card-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-color);
}

.recommendation-card-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.recommendation-card-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.recommendation-card-username {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.recommendation-card-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.recommendation-card-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.recommendation-card:hover .recommendation-card-preview-img {
    transform: scale(1.1);
}

.recommendation-card-preview-gradient {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2a2a35 0%, #1a1a20 100%);
}

.recommendation-card-skill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 70%, transparent 100%);
}

.recommendation-card-skill-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    margin: 0;
}

/* Moderation and support polish */
.row > [class*="col-"] .card.h-100 {
    min-height: 132px;
}

.ticket-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.28);
    color: var(--text-main);
    font-weight: 600;
}

.meta-pill.muted {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.ticket-chat-card {
    min-height: 640px;
}

.ticket-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.ticket-message {
    max-width: min(760px, 78%);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    color: var(--text-main);
}

.ticket-message.operator {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(59, 130, 246, 0.35);
}

.ticket-message-author,
.ticket-message-time {
    color: var(--text-secondary);
}

.ticket-reply {
    gap: 10px;
}

.ticket-reply .form-control {
    border-radius: 10px !important;
}

.ticket-reply .btn {
    border-radius: 10px !important;
}

/* Notifications */
.notifications-page {
    max-width: 900px;
    margin: 0 auto;
}

.notification-list {
    display: grid;
    gap: 14px;
}

.notification-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
}

.notification-card.unread {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.08);
}

.notification-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.16);
    color: var(--primary);
    font-size: 1.2rem;
}

.notification-body p {
    margin: 0 0 6px;
    color: var(--text-main);
}

.notification-body span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.notification-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.notification-actions form {
    margin: 0;
}

.empty-state {
    padding: 48px 24px;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 12px;
}

.empty-state h3 {
    color: var(--text-main);
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .user-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .user-card-header {
        justify-content: center;
    }

    .user-card-actions {
        width: 100%;
        justify-content: center;
    }

    .skill-modal-dialog {
        width: min(calc(100% - 20px), 600px);
        margin: 10px auto;
    }

    .skill-modal-actions {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Utilities */
.d-none {
    display: none !important;
}

@media (max-width: 768px) {
    .video-container {
        margin-top: 20px !important;
    }
}
