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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

/* Navigation */
.navbar {
    background: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 1.5rem;
    transition: opacity 0.3s;
}

.nav-links a:hover {
    opacity: 0.8;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 0;
    background: white;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hero h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.hero p {
    font-size: 1.2rem;
    color: #7f8c8d;
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-4px);
}

.feature-card h3 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

/* Status Section */
.status-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.status-section h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.status-box {
    padding: 1rem;
    border-radius: 4px;
    background: #ecf0f1;
}

.status-healthy {
    color: #27ae60;
    font-weight: bold;
}

.status-error {
    color: #e74c3c;
    font-weight: bold;
}

.status-details {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* Actions */
.actions {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.actions h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Forms */
.form-container {
    max-width: 450px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-container h1 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.form-group select {
    cursor: pointer;
    background-color: white;
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    color: #7f8c8d;
    font-size: 0.85rem;
}

.form-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: #7f8c8d;
}

.form-footer a {
    color: #3498db;
    text-decoration: none;
}

.form-footer a:hover {
    text-decoration: underline;
}

/* Messages */
.message {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Profile */
.profile-container {
    max-width: 800px;
    margin: 0 auto;
}

.profile-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #ecf0f1;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    font-weight: bold;
}

.profile-info h2 {
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.profile-info p {
    color: #7f8c8d;
}

.profile-details {
    display: grid;
    gap: 1rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #ecf0f1;
}

.detail-label {
    font-weight: 500;
    color: #2c3e50;
}

.detail-value {
    color: #7f8c8d;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

/* Token Section */
.token-section, .actions-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.token-section h3, .actions-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.token-info {
    display: grid;
    gap: 1rem;
}

.token-item {
    background: #ecf0f1;
    padding: 1rem;
    border-radius: 4px;
}

.token-item strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.token-display {
    display: block;
    padding: 0.5rem;
    background: #2c3e50;
    color: #ecf0f1;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    word-break: break-all;
}

/* Test Results */
.test-results {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 2rem;
}

.test-results h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.test-results pre {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.9rem;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dashboard-card h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.endpoint-list {
    display: grid;
    gap: 0.5rem;
}

.endpoint-item {
    padding: 0.5rem;
    background: #ecf0f1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.method {
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.75rem;
}

.method-get {
    background: #3498db;
    color: white;
}

.method-post {
    background: #27ae60;
    color: white;
}

.stats {
    display: grid;
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: #ecf0f1;
    border-radius: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.feature-list {
    list-style: none;
    display: grid;
    gap: 0.5rem;
}

.feature-list li {
    padding: 0.5rem;
    background: #ecf0f1;
    border-radius: 4px;
}

.api-response {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 2rem;
}

.api-response h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.api-response pre {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: #7f8c8d;
}

/* Admin Styles */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.users-table thead {
    background: #2c3e50;
    color: white;
}

.users-table th,
.users-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.users-table tbody tr:hover {
    background: #f8f9fa;
}

.admin-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    margin: 0 0.25rem;
    transition: transform 0.2s;
}

.btn-icon:hover {
    transform: scale(1.2);
}

.action-buttons {
    white-space: nowrap;
}

.filters {
    margin-bottom: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filters label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: #7f8c8d;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #2c3e50;
}

.admin-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 2rem;
}

.admin-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

/* Messaging Styles */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #ecf0f1;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #7f8c8d;
    font-size: 1rem;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-button:hover {
    color: #2c3e50;
}

.tab-button.active {
    color: #3498db;
    border-bottom-color: #3498db;
    font-weight: 500;
}

.tab-content {
    display: none;
}

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

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

.badge-danger {
    background: #e74c3c;
    color: white;
}

.badge-warning {
    background: #f39c12;
    color: white;
}

.message-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.message-list {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.message-item {
    padding: 1rem;
    border-bottom: 1px solid #ecf0f1;
    cursor: pointer;
    transition: background 0.2s;
}

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

.message-item:hover {
    background: #f8f9fa;
}

.message-item.unread {
    background: #e8f4fd;
    border-left: 4px solid #3498db;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.message-header strong {
    color: #2c3e50;
}

.message-meta {
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.message-preview {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.message-details {
    padding: 1rem;
    background: #ecf0f1;
    border-radius: 4px;
    margin-bottom: 1rem;
    line-height: 1.8;
}

.message-body {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

.form textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form small {
    display: block;
    margin-top: 0.25rem;
    color: #7f8c8d;
    font-size: 0.85rem;
}

.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.text-muted {
    color: #7f8c8d;
    padding: 1rem;
}

.nav {
    background: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav .nav-links a.active {
    text-decoration: underline;
}

/* Marketplace Styles */
.marketplace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.listing-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.3s, transform 0.2s;
    background: white;
}

.listing-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.listing-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f5f5f5;
}

.listing-info {
    padding: 1rem;
}

.listing-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-size: 1.1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.listing-price {
    color: #3498db;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.sold-out-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #e0e0e0;
}

.sold-out-section h2 {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}

.listing-card.sold-out {
    position: relative;
    cursor: pointer;
}

.listing-card.sold-out::after {
    content: "SOLD OUT";
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 1;
}

.quantity-badge {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.quantity-badge.available {
    color: #27ae60;
    background: #d4edda;
}

.quantity-badge.sold {
    color: #e74c3c;
    background: #f8d7da;
}

.availability-box {
    margin: 1.5rem 0;
    padding: 1.25rem;
    border-radius: 8px;
    text-align: center;
}

.availability-box.available {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 2px solid #28a745;
}

.availability-box.sold-out {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border: 2px solid #dc3545;
}

.availability-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.availability-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

.image-upload-preview {
    max-width: 300px;
    max-height: 300px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.status-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-sold {
    background: #cce5ff;
    color: #004085;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .detail-row {
        flex-direction: column;
        gap: 0.25rem;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
    }

    .users-table {
        font-size: 0.85rem;
    }

    .users-table th,
    .users-table td {
        padding: 0.5rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .marketplace-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
}
