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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #0f0f0f;
    color: #e0e0e0;
    line-height: 1.6;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    padding: 1.5rem 2rem;
    border-bottom: 2px solid #333;
}

header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

header p {
    font-size: 0.875rem;
    color: #aaa;
}

/* Navigation Tabs */
nav {
    background: #1a1a1a;
    padding: 0 2rem;
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid #333;
}

.tab-btn {
    background: none;
    border: none;
    color: #aaa;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* Main Content */
main {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.tab-content {
    display: none;
}

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

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

.section-header h2 {
    font-size: 1.5rem;
}

/* Filters */
.filters {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filters select {
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #444;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
}

/* Items List - New List View */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    background: transparent;
    border-radius: 0;
    overflow: visible;
    border: none;
}

.date-group {
    background: #1a1a1a;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #333;
}

.date-group-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #141414 0%, #1f1f1f 100%);
    border-bottom: 1px solid #2a2a2a;
}

.date-group-title-date {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: #e0e0e0;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.date-group-title-meta {
    color: #888;
    font-size: 0.85rem;
}

.date-group-list {
    display: flex;
    flex-direction: column;
}

.list-item {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #2a2a2a;
    transition: background 0.2s;
}

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

.list-item:hover {
    background: #222;
}

.list-item.expanded {
    background: #222;
}

.list-item-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    cursor: pointer;
}

/* Thumbnail */
.list-item-thumbnail {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    margin-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #333;
}

.list-item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-item-thumbnail.loading {
    background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    font-size: 0.7rem;
    color: #666;
    text-align: center;
    padding: 0.5rem;
    line-height: 1.2;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* List Item Info */
.list-item-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 2rem;
    min-width: 0;
}

.list-item-status {
    margin-left: auto;
    margin-right: 1rem;
}

.list-item-time {
    font-size: 0.875rem;
    color: #aaa;
    font-family: monospace;
    white-space: nowrap;
    min-width: 140px;
}

.list-item-title {
    flex: 1;
    min-width: 0;
}

.list-item-title h3 {
    font-size: 1rem;
    font-weight: 500;
    color: #e0e0e0;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-title .item-id {
    font-size: 0.75rem;
    color: #667eea;
    font-family: monospace;
}

/* List Item Actions */
.list-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-left: 1rem;
}

/* Always show action buttons (better for touch / clarity) */
.list-item-actions .btn-small { opacity: 1; }

/* Expandable Details */
.list-item-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.list-item.expanded .list-item-details {
    max-height: 2000px;
}

.list-item-details-content {
    padding: 1rem 1rem 1rem 97px;
    border-top: 1px solid #2a2a2a;
    background: #1a1a1a;
}

.details-section {
    margin-bottom: 1rem;
}

.details-section:last-child {
    margin-bottom: 0;
}

.details-section h4 {
    font-size: 0.875rem;
    color: #aaa;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.detail-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
}

.detail-label {
    color: #888;
}

.detail-value {
    color: #e0e0e0;
    font-weight: 500;
    font-family: monospace;
}

/* Parameters Display */
.parameters-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.parameter-item {
    background: #2a2a2a;
    padding: 0.5rem;
    border-radius: 4px;
    text-align: center;
}

.parameter-item-label {
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 0.25rem;
}

.parameter-item-value {
    font-size: 0.875rem;
    color: #667eea;
    font-family: monospace;
    font-weight: 600;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #444;
}

.btn-secondary:hover {
    background: #333;
    border-color: #555;
}

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

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

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: #fbbf24;
    color: #78350f;
}

.status-paid {
    background: #4ade80;
    color: #14532d;
}

.status-completed {
    background: #60a5fa;
    color: #1e3a8a;
}

.status-cancelled {
    background: #f87171;
    color: #7f1d1d;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination button {
    padding: 0.5rem 1rem;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: #333;
}

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

.pagination button.active {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

.pagination-ellipsis {
    color: #777;
    padding: 0 0.25rem;
    user-select: none;
}

/* Settings Form */
.settings-form {
    max-width: 600px;
    background: #1a1a1a;
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid #333;
}

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

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #444;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

#settings-status {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #4ade80;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    background: #1a1a1a;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
}

.modal-content.large {
    max-width: 800px;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

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

.modal-body {
    padding: 2rem;
}

.modal-body h3 {
    margin: 1.5rem 0 1rem 0;
    font-size: 1.125rem;
    color: #667eea;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
    color: #aaa;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #aaa;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

    nav {
        padding: 0 1rem;
    }

    main {
        padding: 1rem;
    }

    .items-list {
        grid-template-columns: 1fr;
    }

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

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header,
    .modal-body {
        padding: 1rem;
    }
}
