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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.hidden { display: none !important; }

/* Login */
#login-view, #setup-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.card h1, .card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.card input, .card select {
    width: 100%;
    padding: 0.875rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.card label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.card button {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

.card button:hover { background: var(--primary-dark); }

.error { color: var(--danger); font-size: 0.875rem; margin-top: 0.5rem; text-align: center; }

.alt-login {
    text-align: center;
    margin: 1rem 0;
    color: var(--text-light);
}

.btn-secondary { background: var(--text-light) !important; }
.btn-danger { background: var(--danger) !important; }

/* Header */
header {
    background: var(--primary);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 { font-size: 1.25rem; }

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

.status-dot.error { background: var(--danger); animation: none; }
.status-dot.warning { background: var(--warning); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#settings-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Content */
.content {
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.empty-message {
    text-align: center;
    color: var(--text-light);
    padding: 3rem;
}

/* Items */
#items-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.item-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.item-type {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.item-type-icon {
    font-size: 1.25rem;
}

.item-time {
    font-size: 0.75rem;
    color: var(--text-light);
}

.item-content {
    padding: 1rem;
    text-align: center;
}

.item-text {
    background: var(--bg);
    padding: 1rem;
    border-radius: 8px;
    font-family: monospace;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
}

.item-image {
    display: block;
    max-width: 100%;
    max-height: 400px;
    margin: 0 auto;
    border-radius: 8px;
    cursor: pointer;
    object-fit: contain;
}

.item-file {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    text-align: left;
}

.item-file-icon { font-size: 2rem; }
.item-file-name { font-weight: 500; }
.item-file-type { font-size: 0.75rem; color: var(--text-light); }

.item-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.item-actions button {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
}

.btn-open { background: var(--primary); color: white; }
.btn-copy { background: var(--success); color: white; }
.btn-download { background: var(--warning); color: white; }
.btn-done { background: var(--text-light); color: white; }

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}

.modal-content {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2, .modal-content h3 {
    margin-bottom: 1rem;
}

.modal-content label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.modal-content label input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.modal-content select, .modal-content input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.modal-content button {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

#settings-save { background: var(--primary); color: white; }
#settings-logout { background: var(--danger); color: white; }
#settings-close { background: var(--text-light); color: white; }

/* Item Modal */
.item-modal-content {
    max-width: 600px;
}

.item-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

#item-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: auto;
}

#item-modal-body {
    margin-bottom: 1rem;
}

#item-modal-body img {
    max-width: 100%;
    border-radius: 8px;
}

#item-modal-body textarea {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: monospace;
    resize: vertical;
}

#item-modal-actions {
    display: flex;
    gap: 0.5rem;
}

#item-modal-actions button {
    flex: 1;
}
