/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-accent-text, #fff);
}

.btn-primary:hover {
    background-color: var(--color-accent-hover);
    color: var(--color-accent-text, #fff);
}

.btn-secondary {
    background-color: var(--color-bg-tertiary);
    color: var(--color-text);
}

.btn-secondary:hover {
    background-color: var(--color-border);
}

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

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

.btn-lg {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--font-size-base);
}

.btn-icon {
    padding: var(--space-sm);
    border-radius: var(--radius-full);
}

/* Form Elements */
.input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input:focus {
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.input:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.input::placeholder {
    color: var(--color-text-muted);
}

.label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
}

.form-group {
    margin-bottom: var(--space-md);
}

/* Cards */
.card {
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-image {
    aspect-ratio: 4 / 3;
    background-color: var(--color-bg-tertiary);
    object-fit: cover;
}

.card-body {
    padding: var(--space-md);
}

.card-title {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-xs);
}

.card-price {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
}

.card-meta {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-sm);
}

/* Grid */
.grid {
    display: grid;
    gap: var(--space-md);
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-2 { grid-template-columns: 1fr; }
}

/* Listings Grid - responsive columns */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-md);
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-full);
    background-color: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
}

.badge-primary {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
}

/* Header Component */
app-header {
    display: block;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background-color: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    transition: box-shadow var(--transition-fast);
}

app-header.scrolled {
    box-shadow: var(--shadow-sm);
}

app-header .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    gap: var(--space-md);
}

app-header .logo {
    display: flex;
    align-items: center;
}

app-header .logo-img {
    height: 28px;
    width: auto;
}

app-header .logo-dark {
    display: none;
}

[data-theme="dark"] app-header .logo-light {
    display: none;
}

[data-theme="dark"] app-header .logo-dark {
    display: block;
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) app-header .logo-light {
        display: none;
    }
    html:not([data-theme="light"]) app-header .logo-dark {
        display: block;
    }
}

app-header .search-box {
    flex: 1;
    max-width: 500px;
}

app-header .header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

app-header .btn-create {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
}

app-header .btn-create-text {
    display: inline;
}

app-header .btn-login,
app-header .btn-profile {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
}

app-header .btn-login-text,
app-header .btn-profile-text {
    display: inline;
}

@media (max-width: 768px) {
    app-header .btn-create {
        padding: var(--space-sm);
        border-radius: var(--radius-full);
    }
    
    app-header .btn-create-text {
        display: none;
    }

    app-header .btn-login,
    app-header .btn-profile {
        padding: var(--space-sm);
        border-radius: var(--radius-full);
    }
    
    app-header .btn-login-text,
    app-header .btn-profile-text {
        display: none;
    }
}

/* Footer Component */
app-footer {
    display: block;
    background-color: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border);
    padding: var(--space-lg) 0;
    margin-top: auto;
}

app-footer .footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
}

app-footer .footer-swiss {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

app-footer .xmr-rate {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

app-footer .xmr-rate.loaded {
    opacity: 1;
}

app-footer .footer-links {
    display: flex;
    gap: var(--space-md);
}

app-footer .footer-links a {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}

/* App Shell */
app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

app-shell main {
    flex: 1;
    padding: var(--space-lg) 0;
}

/* Page Transitions */
.page-enter {
    opacity: 0;
    transform: translateY(10px);
}

.page-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-3xl);
    color: var(--color-text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.empty-state p {
    margin-bottom: var(--space-lg);
}

.empty-state .btn {
    margin-top: var(--space-md);
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 45px;
    right: 0;
    min-width: 150px;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-xs);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    background: none;
    border: none;
    font-size: inherit;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.dropdown-item:hover {
    background-color: var(--color-bg-secondary);
}

.dropdown-item.active {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
}

.dropdown-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.dropdown-item-danger {
    color: var(--color-error);
}

.dropdown-item-danger:hover {
    background-color: var(--color-error);
    color: white;
}

.dropdown-item-danger:hover svg {
    opacity: 1;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--color-border);
    margin: var(--space-xs) 0;
}

.dropdown-menu-right {
    right: 0;
    left: auto;
}

/* Notification Badge */
.notification-bell {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: var(--font-weight-bold);
    line-height: 18px;
    text-align: center;
    color: #fff;
    background-color: var(--color-accent);
    border-radius: var(--radius-full);
}
