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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f5f5f5;
    color: #1a1a1a;
    line-height: 1.5;
}

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

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e5e5;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #666;
}

.logout-link {
    color: #3b82f6;
    text-decoration: none;
}

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

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.login-state {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e5e5;
}

.login-state h2 {
    margin-bottom: 8px;
    font-size: 24px;
}

.login-state p {
    color: #666;
    margin-bottom: 24px;
}

.login-btn {
    display: inline-block;
    background: #3b82f6;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s ease;
}

.login-btn:hover {
    background: #2563eb;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e5e5;
}

/* Filters */
.filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e5e5;
    gap: 16px;
}

.view-toggle {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 8px;
}

.view-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
}

.view-btn:hover {
    color: #374151;
}

.view-btn.active {
    background: white;
    color: #1f2937;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.type-filter select {
    padding: 8px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    color: #374151;
    cursor: pointer;
}

.type-filter select:focus {
    outline: none;
    border-color: #3b82f6;
}

/* Now Divider */
.now-divider {
    display: flex;
    align-items: center;
    margin: 8px 0;
    gap: 12px;
}

.now-divider::before,
.now-divider::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}

.now-divider span {
    padding: 4px 16px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    color: white;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 12px;
}

/* Event Date Badge */
.event-date-badge {
    background: linear-gradient(90deg, #f0f9ff, #ede9fe);
    color: #4f46e5;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px 8px 0 0;
    margin: -16px -16px 12px -16px;
    border-bottom: 1px solid #e5e7eb;
}

.items-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.item-card {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 16px;
    transition: box-shadow 0.2s ease;
}

.item-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.item-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.type-badge.media {
    background-color: #dcfce7;
    color: #166534;
}

.type-badge.image {
    background-color: #dcfce7;
    color: #166534;
}

.type-badge.video {
    background-color: #fef3c7;
    color: #92400e;
}

.type-badge.audio {
    background-color: #e0f2fe;
    color: #075985;
}

.type-badge.screenshot {
    background-color: #f3e8ff;
    color: #7c3aed;
}

.type-badge.web_url {
    background-color: #dbeafe;
    color: #1e40af;
}

.type-badge.file {
    background-color: #ffedd5;
    color: #9a3412;
}

.type-badge.text {
    background-color: #f3f4f6;
    color: #374151;
}

.item-content {
    margin-bottom: 12px;
}

.item-image {
    max-width: 100%;
    max-height: 250px;
    width: auto;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
    background: #f5f5f5;
    display: block;
}

.item-video,
.item-audio {
    width: 100%;
    border-radius: 8px;
    background: #f5f5f5;
}

.item-video {
    max-height: 280px;
}

.item-image-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    background: #f5f5f5;
    border-radius: 8px;
    color: #999;
    font-size: 14px;
}

.item-url {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s ease;
}

.item-url:hover {
    background: #f3f4f6;
}

.item-url-favicon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.item-url-info {
    flex: 1;
    min-width: 0;
}

.item-url-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-url-domain {
    font-size: 12px;
    color: #666;
}

.item-text {
    font-size: 14px;
    color: #374151;
    white-space: pre-wrap;
    word-break: break-word;
}

.item-text.truncated {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
}

.item-text.expanded {
    cursor: pointer;
    max-height: 400px;
    overflow-y: auto;
}

.item-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
}

.item-file-icon {
    font-size: 24px;
}

.item-file-name {
    font-weight: 500;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-file-link {
    margin-left: auto;
    font-size: 12px;
    color: #3b82f6;
    text-decoration: none;
}

.item-file-link:hover {
    text-decoration: underline;
}

.item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}

.item-date {
    font-size: 12px;
    color: #999;
}

.delete-btn {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.delete-btn:hover {
    background: #fecaca;
}

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

.info-btn {
    background: #f3f4f6;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.info-btn:hover {
    background: #e5e7eb;
}

.info-btn.active {
    background: #dbeafe;
}

.item-details {
    margin-top: 12px;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 12px;
}

.item-details-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

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

.item-details-label {
    color: #6b7280;
    flex-shrink: 0;
}

.item-details-value {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
    color: #9ca3af;
    word-break: break-all;
}

.item-details-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.item-tag {
    display: inline-block;
    padding: 2px 6px;
    background: #e5e7eb;
    color: #374151;
    border-radius: 4px;
    font-size: 11px;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.new-item-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.new-item-btn:hover {
    background: #2563eb;
}

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

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

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    margin: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5e5;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

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

/* Create Form */
.create-form {
    padding: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    cursor: pointer;
}

.form-group input[type="file"]:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.form-hint {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.type-field {
    display: none;
}

.type-field.visible {
    display: block;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e5e5e5;
}

.btn-cancel {
    background: #f3f4f6;
    color: #374151;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-cancel:hover {
    background: #e5e7eb;
}

.btn-submit {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-submit:hover {
    background: #2563eb;
}

.btn-submit:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .container {
        padding: 16px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .item-card {
        padding: 12px;
    }
}
