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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #0d1117;
    color: #c9d1d9;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar */
.navbar {
    background-color: #161b22;
    border-bottom: 1px solid #30363d;
    padding: 12px 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: #58a6ff;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: bold;
}

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

.nav-links a {
    color: #8b949e;
    text-decoration: none;
    margin-left: 14px;
    transition: color 0.2s;
    font-size: 14px;
}

.nav-links a:hover {
    color: #c9d1d9;
}

.nav-user {
    color: #58a6ff;
    font-size: 13px;
    margin-left: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.nav-admin {
    color: #d29922 !important;
}

.lang-selector {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.lang-link {
    color: #484f58 !important;
    font-size: 12px !important;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-decoration: none !important;
}

.lang-link.active {
    color: #58a6ff !important;
    background: rgba(88, 166, 255, 0.1);
}

.nav-logout-btn {
    background: none;
    border: 1px solid #30363d;
    color: #8b949e;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    margin-left: 8px;
    transition: all 0.2s;
}

.nav-logout-btn:hover {
    color: #f85149;
    border-color: #f85149;
}

/* Hamburger toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    flex-direction: column;
    gap: 5px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #c9d1d9;
    transition: all 0.3s;
}

.nav-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #238636;
    color: #fff;
}

.btn-primary:hover {
    background-color: #2ea043;
}

.btn-outline {
    background: transparent;
    border: 1px solid #30363d;
    color: #c9d1d9;
}

.btn-outline:hover {
    border-color: #8b949e;
}

.btn-outline.active {
    border-color: #58a6ff;
    color: #58a6ff;
}

.btn-danger {
    background-color: #da3633;
    color: #fff;
}

.btn-danger:hover {
    background-color: #f85149;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

.btn-full {
    width: 100%;
    text-align: center;
}

/* Main content */
main {
    padding: 24px 0;
    min-height: calc(100vh - 120px);
}

h1 {
    margin-bottom: 20px;
    color: #f0f6fc;
}

h2 {
    margin-bottom: 16px;
    color: #f0f6fc;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background-color: #3d1114;
    border: 1px solid #f85149;
    color: #f85149;
}

.alert-success {
    background-color: #0d2818;
    border: 1px solid #3fb950;
    color: #3fb950;
}

.alert-info {
    background-color: #0c2d6b;
    border: 1px solid #58a6ff;
    color: #58a6ff;
}

/* Auth pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-card {
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 8px;
}

.auth-subtitle {
    text-align: center;
    color: #8b949e;
    margin-bottom: 24px;
    font-size: 14px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #8b949e;
}

.auth-footer a {
    color: #58a6ff;
    text-decoration: none;
}

/* Form elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #c9d1d9;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    background-color: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Filters */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filters select,
.filters input {
    padding: 8px 12px;
    background-color: #21262d;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 14px;
}

.filter-search {
    min-width: 200px;
}

/* Toggle label */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #8b949e;
    cursor: pointer;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: #161b22;
    border-radius: 6px;
    overflow: hidden;
}

th {
    background-color: #21262d;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #8b949e;
    font-size: 12px;
    text-transform: uppercase;
}

td {
    padding: 12px 16px;
    border-top: 1px solid #21262d;
    font-size: 14px;
}

tr:hover {
    background-color: #1c2128;
}

.profit-positive {
    color: #3fb950;
    font-weight: bold;
}

.profit-high {
    color: #3fb950;
}

.profit-medium {
    color: #d29922;
}

.confidence-high { color: #3fb950; }
.confidence-medium { color: #d29922; }
.confidence-low { color: #f85149; }

/* Marketplace label */
.mp-label {
    color: #8b949e;
    font-size: 11px;
    text-transform: uppercase;
}

.mp-logo {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 4px;
}

.mp-link {
    color: #58a6ff;
    text-decoration: none;
    font-size: 12px;
}

.mp-link:hover {
    text-decoration: underline;
}

/* Item cells */
.item-cell {
    max-width: 250px;
}

.item-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #c9d1d9;
    transition: color 0.2s;
}

.item-link:hover {
    color: #58a6ff;
}

.item-name {
    font-size: 13px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
    display: block;
}

/* Item image */
.item-img {
    width: 48px;
    height: 36px;
    object-fit: contain;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Item detail page */
.item-detail-header {
    margin-bottom: 20px;
}

.item-detail-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.item-detail-img {
    width: 120px;
    height: 90px;
    object-fit: contain;
}

.range-selector {
    display: flex;
    gap: 4px;
}

/* Cards */
.card {
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 16px;
}

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

/* Settings page */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #21262d;
    font-size: 14px;
}

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

.settings-label {
    color: #8b949e;
}

/* Pricing cards */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 32px 0;
}

.pricing-card {
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    transition: border-color 0.2s;
}

.pricing-card:hover {
    border-color: #58a6ff;
}

.pricing-card.popular {
    border-color: #238636;
    position: relative;
}

.pricing-card.popular::before {
    content: "Most Popular";
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #238636;
    color: #fff;
    padding: 2px 16px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.pricing-card.current {
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

.pricing-tier {
    font-size: 20px;
    font-weight: 700;
    color: #f0f6fc;
    margin-bottom: 8px;
}

.pricing-price {
    font-size: 36px;
    font-weight: 700;
    color: #f0f6fc;
    margin-bottom: 4px;
}

.pricing-price span {
    font-size: 16px;
    color: #8b949e;
    font-weight: 400;
}

.pricing-features {
    text-align: left;
    margin: 24px 0;
    list-style: none;
}

.pricing-features li {
    padding: 6px 0;
    font-size: 14px;
    color: #8b949e;
}

.pricing-features li::before {
    content: "\2713 ";
    color: #3fb950;
    font-weight: bold;
    margin-right: 6px;
}

.pricing-features li.disabled {
    color: #484f58;
    text-decoration: line-through;
}

.pricing-features li.disabled::before {
    content: "\2717 ";
    color: #f85149;
}

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

.stat-card {
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #58a6ff;
}

.stat-label {
    font-size: 13px;
    color: #8b949e;
    margin-top: 4px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-free { background: #21262d; color: #8b949e; }
.badge-pro { background: #0c2d6b; color: #58a6ff; }
.badge-premium { background: #2d1600; color: #d29922; }
.badge-active { background: #0d2818; color: #3fb950; }
.badge-pending { background: #2d1600; color: #d29922; }
.badge-rejected { background: #3d1114; color: #f85149; }
.badge-high { background: #0d2818; color: #3fb950; }
.badge-medium { background: #2d1600; color: #d29922; }
.badge-low { background: #3d1114; color: #f85149; }

/* Toggle switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #30363d;
    border-radius: 22px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #c9d1d9;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
    background-color: #238636;
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

/* Action buttons in table */
.action-btns {
    display: flex;
    gap: 6px;
}

.action-btn {
    background: none;
    border: 1px solid #30363d;
    color: #8b949e;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: #58a6ff;
    color: #58a6ff;
}

.action-btn.delete:hover {
    border-color: #f85149;
    color: #f85149;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}

.page-info {
    color: #8b949e;
    font-size: 14px;
}

/* Loading spinner */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 0;
    color: #8b949e;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #30363d;
    border-top-color: #58a6ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background-color: #161b22;
    border: 1px solid #238636;
    color: #3fb950;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.toast.show {
    transform: translateX(0);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #8b949e;
}

.empty-state h3 {
    color: #c9d1d9;
    margin-bottom: 8px;
}

/* Section spacing */
.section {
    margin-bottom: 32px;
}

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

/* Footer */
.footer {
    text-align: center;
    padding: 16px 0;
    color: #484f58;
    font-size: 12px;
    border-top: 1px solid #21262d;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #161b22;
        border-bottom: 1px solid #30363d;
        flex-direction: column;
        padding: 16px 20px;
        gap: 12px;
        z-index: 100;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        margin-left: 0;
        font-size: 14px;
    }

    .nav-user {
        margin-left: 0;
    }

    .navbar .container {
        position: relative;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px 10px;
    }

    .item-name {
        max-width: 120px;
        font-size: 11px;
    }

    .item-img {
        width: 32px;
        height: 24px;
    }

    .item-detail-title {
        flex-direction: column;
        align-items: flex-start;
    }

    .item-detail-img {
        width: 80px;
        height: 60px;
    }

    .filters {
        gap: 8px;
    }

    .filter-search {
        min-width: 100%;
    }
}
