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

body {
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background: #fafafa;
    color: #333;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

header p {
    color: #666;
}

.user-menu {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 0.9rem;
}

.user-menu a {
    color: #0066cc;
    text-decoration: none;
}

.user-menu a:hover {
    text-decoration: underline;
}

.user-menu .email {
    color: #666;
    margin-right: 0.5rem;
}

.user-menu button {
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    background: #e0e0e0;
    color: #333;
}

.user-menu button:hover {
    background: #d0d0d0;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 0.5rem;
}

.modal-content p {
    color: #666;
    margin-bottom: 1rem;
}

.modal-content input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.modal-content input:focus {
    outline: none;
    border-color: #0066cc;
}

.modal-content .error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c00;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.modal-content .error.hidden {
    display: none;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.modal-actions button {
    padding: 0.5rem 1rem;
}

.modal-actions .secondary {
    background: #e0e0e0;
    color: #333;
}

.tool-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.nav-item {
    padding: 0.5rem 1.25rem;
    background: white;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: background 0.2s, color 0.2s;
}

.nav-item:hover {
    background: #f0f7ff;
}

.nav-item.active {
    background: #0066cc;
    color: white;
}

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

.tool-card h2 {
    margin-bottom: 0.5rem;
}

.tool-card > p {
    color: #666;
    margin-bottom: 1.5rem;
}

.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #0066cc;
    background: #f0f7ff;
}

.drop-zone p {
    color: #666;
}

.preview {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

.preview-item {
    position: relative;
    width: 120px;
}

.preview-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.preview-item .remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: #e74c3c;
    color: white;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.preview-item .remove:hover {
    background: #c0392b;
}

.order-controls {
    position: absolute;
    bottom: 4px;
    left: 4px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.preview-item .order {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.preview-item .move-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-item .move-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
}

.download-link {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #27ae60;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
}

.filename-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    width: 150px;
}

button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

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

#clearBtn {
    background: #e0e0e0;
    color: #333;
}

#clearBtn:hover:not(:disabled) {
    background: #d0d0d0;
}

#createBtn {
    background: #0066cc;
    color: white;
}

#createBtn:hover:not(:disabled) {
    background: #0052a3;
}

footer {
    margin-top: 2rem;
    text-align: center;
    color: #999;
    font-size: 0.875rem;
}

@media (max-width: 600px) {
    .user-menu {
        position: static;
        text-align: right;
        margin-bottom: 0.5rem;
    }
}

footer a {
    color: #999;
    text-decoration: none;
}

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

/* Legal page */
.legal h2 {
    margin-top: 2rem;
}

.legal h2:first-child {
    margin-top: 0;
}

.legal h3 {
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.legal p, .legal ul {
    color: #555;
    margin-bottom: 0.5rem;
}

.legal ul {
    padding-left: 1.5rem;
}

.legal hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 2rem 0;
}
