@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

body {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    /* 白を基調とし、うすい水色とピンクのシンプルなグラデーション */
    background: linear-gradient(135deg, #f8fafc 0%, #e0f2fe 50%, #fce7f3 100%);
    color: #334155;
    overflow: auto; /* Changed from hidden to auto for scrolling */
}

/* 派手な背景アニメーションは非表示にしてシンプルにする */
.background-shapes {
    display: none;
}

.login-container {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 48px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1e293b;
}

.login-header p {
    color: #64748b;
    font-size: 0.9rem;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #475569;
}

.input-group input, .input-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    color: #334155;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.input-group input:focus, .input-group textarea:focus {
    outline: none;
    border-color: #7dd3fc;
    box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.2);
}

.input-group textarea {
    resize: vertical;
}

.login-btn, .btn-primary {
    width: 100%;
    padding: 14px;
    margin-top: 8px;
    background: #334155; /* シンプルなダークグレー */
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.login-btn:hover, .btn-primary:hover {
    background: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.login-btn:active, .btn-primary:active {
    transform: translateY(0);
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #ef4444;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 24px;
    text-align: center;
}

.success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 24px;
    text-align: center;
}

/* Dashboard Styles */
.dashboard-container {
    text-align: center;
    z-index: 1;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 56px 40px;
    max-width: 500px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.dashboard-container h1 {
    font-size: 2rem;
    margin-bottom: 12px;
    color: #1e293b;
}

.dashboard-container p {
    color: #64748b;
    margin-bottom: 32px;
    font-size: 1rem;
}

.dashboard-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.logout-btn, .btn-secondary {
    display: inline-block;
    padding: 10px 28px;
    background: transparent;
    color: #475569;
    text-decoration: none;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.logout-btn:hover, .btn-secondary:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #94a3b8;
}

/* Notes Styles */
body.notes-page {
    align-items: flex-start;
    padding: 40px 20px;
}

.notes-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.notes-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.header-left {
    position: absolute;
    left: 0;
}

.notes-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.header-actions {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ios-btn {
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #007aff;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: opacity 0.2s;
}
.ios-btn:hover {
    opacity: 0.7;
}
.user-badge {
    font-size: 0.85rem;
    color: #64748b;
    margin-right: 4px;
}

.create-note-section {
    margin-bottom: 40px;
    background: #ffffff;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

.create-note-section h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: #334155;
}

.notes-list-section h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #334155;
}

.notes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.note-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    transition: all 0.2s ease;
}

.note-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

.note-card-header {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    margin-bottom: 12px;
}

.note-card-header h3 {
    font-size: 1.1rem;
    color: #1e293b;
    margin-right: 16px;
}

.note-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.edit-btn {
    color: #0284c7;
    background: #e0f2fe;
}
.edit-btn:hover { background: #bae6fd; }

.delete-btn {
    color: #e11d48;
    background: #ffe4e6;
}
.delete-btn:hover { background: #fecdd3; }

.share-btn {
    color: #059669;
    background: #d1fae5;
}
.share-btn:hover { background: #a7f3d0; }

.inline-form {
    display: inline;
}

.note-content {
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.2;
    margin-bottom: 16px;
}

.note-meta {
    font-size: 0.8rem;
    color: #94a3b8;
    display: flex;
    justify-content: flex-start;
    gap: 16px;
    border-top: 1px solid #f1f5f9;
    padding-top: 12px;
}

.meta-item.edited {
    color: #0284c7;
}

.empty-state {
    text-align: center;
    color: #94a3b8;
    padding: 40px 0;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #ffffff;
    margin: 10% auto;
    padding: 32px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    position: relative;
}

.close {
    position: absolute;
    right: 24px;
    top: 24px;
    color: #94a3b8;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #1e293b;
}

.modal-content h2 {
    margin-bottom: 24px;
    font-size: 1.2rem;
    color: #1e293b;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.modal-actions button {
    width: auto;
    margin: 0;
}

/* Advanced Notes Styles */
.controls-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}
.controls-bar input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 12px;
    border: none;
    background-color: #f1f5f9;
    font-size: 0.95rem;
    outline: none;
    transition: background-color 0.2s;
}
.controls-bar input:focus {
    background-color: #e2e8f0;
}

.controls-bar select {
    -webkit-appearance: none;
    appearance: none;
    background-color: #f1f5f9;
    color: #007aff;
    border: none;
    font-weight: 500;
    padding: 10px 36px 10px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23007aff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    cursor: pointer;
    outline: none;
    transition: background-color 0.2s;
}
.controls-bar select:hover {
    background-color: #e2e8f0;
}

.title-with-pin {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pinned-icon {
    font-size: 1.1rem;
}

.pin-btn.active, .like-btn.liked {
    background: #fef08a !important;
    color: #ca8a04 !important;
    border: 1px solid #fde047;
}
.pin-btn:hover { background: #fef9c3; }

.like-btn {
    color: #ef4444;
    background: #fef2f2;
}
.like-btn:hover { background: #fee2e2; }

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.tag-badge {
    background: rgba(255, 255, 255, 0.5);
    color: #475569;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.color-group {
    margin-bottom: 20px;
}
.color-options {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}
.color-options label {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.color-options input[type="radio"] {
    display: none;
}
.color-circle {
    display: inline-block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    transition: transform 0.2s, box-shadow 0.2s;
}
.color-options input[type="radio"]:checked + .color-circle {
    transform: scale(1.2);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #3b82f6;
}

.note-meta-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 12px;
}
.note-meta { border-top: none; padding-top: 0; flex-direction: column; gap: 4px; }

/* Markdown Styles */
.markdown-body h1 { font-size: 1.5rem; margin-bottom: 12px; color: #1e293b; }
.markdown-body h2 { font-size: 1.3rem; margin-bottom: 10px; color: #1e293b; }
.markdown-body h3 { font-size: 1.1rem; margin-bottom: 8px; color: #1e293b; }
.markdown-body p { margin-bottom: 8px; }
.markdown-body ul, .markdown-body ol { margin-left: 20px; margin-bottom: 8px; }
.markdown-body code { background: rgba(0,0,0,0.05); padding: 2px 4px; border-radius: 4px; }
.markdown-body pre { background: #f1f5f9; padding: 12px; border-radius: 8px; overflow-x: auto; margin-bottom: 12px; }
.markdown-body blockquote { border-left: 4px solid #cbd5e1; padding-left: 12px; color: #64748b; margin-bottom: 12px; }

/* Folder Tabs */
.folder-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 20px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.folder-tabs::-webkit-scrollbar {
    height: 6px;
}
.folder-tabs::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}
.folder-tab {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.folder-tab:hover {
    background: #e2e8f0;
}
.folder-tab.active {
    background: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}
.folder-tab-add {
    padding: 8px 12px;
    background: #e2e8f0;
    font-weight: bold;
}

/* Bulk Actions Bar */
.bulk-actions-bar {
    background: #e0f2fe;
    border: 1px solid #0ea5e9;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideDown 0.3s ease;
}

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

.bulk-actions-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
}

#selectedCount {
    font-weight: 600;
    color: #0369a1;
    min-width: 100px;
}

.bulk-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bulk-buttons .btn-icon {
    background: #e0f2fe;
    color: #0284c7;
    border: 1px solid #0ea5e9;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.bulk-buttons .btn-icon:hover {
    background: #bae6fd;
    color: #0c63e4;
    border-color: #0284c7;
}

.copy-to-shared-btn {
    color: #059669;
}
.copy-to-shared-btn:hover {
    background: #d1fae5;
    border-color: #059669;
}

.move-folder-btn {
    color: #7c3aed;
}
.move-folder-btn:hover {
    background: #ede9fe;
    border-color: #7c3aed;
}

.bulk-delete-btn {
    color: #e11d48;
}
.bulk-delete-btn:hover {
    background: #ffe4e6;
    border-color: #e11d48;
}

.cancel-selection-btn {
    color: #6b7280;
}
.cancel-selection-btn:hover {
    background: #e5e7eb;
    border-color: #6b7280;
}

/* Checkbox Styling */
.note-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #0284c7;
    flex-shrink: 0;
}

/* Responsive Bulk Actions Bar */
@media (max-width: 768px) {
    .bulk-actions-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .bulk-actions-content {
        flex-direction: column;
        width: 100%;
    }

    .bulk-buttons {
        width: 100%;
        justify-content: space-between;
    }

    .bulk-buttons .btn-icon {
        flex: 1;
        text-align: center;
    }

    #selectedCount {
        width: 100%;
        margin-bottom: 8px;
    }
}



.title-with-pin {
    flex: 1;
}

.note-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.folder-delete-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-weight: bold;
    cursor: pointer;
    padding: 0 4px;
    font-size: 1.2rem;
    transition: opacity 0.2s ease;
}

.folder-delete-btn:hover {
    opacity: 0.7;
}

/* Collapse Content Styles */
.note-content-display.collapsed {
    max-height: 240px;
    overflow: hidden;
}

.note-content-display {
    word-wrap: break-word;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.collapse-indicator {
    display: inline;
    color: #6b7280;
    font-weight: 600;
}

.collapse-btn {
    margin-top: 8px;
    padding: 4px 12px;
    background-color: #e5e7eb;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s ease;
}

.collapse-btn:hover {
    background-color: #d1d5db;
}

/* Responsive Design */
@media (max-width: 768px) {
    body.notes-page {
        padding: 20px 10px;
    }
    .notes-container {
        padding: 20px;
    }
    .notes-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .header-left {
        position: static;
        order: 1;
    }
    .notes-header h1 {
        order: 2;
        align-self: center;
    }
    .header-actions {
        position: static;
        order: 3;
        width: 100%;
        justify-content: space-between;
    }
    .controls-bar {
        flex-direction: column;
        gap: 8px;
    }
    .controls-bar input {
        width: 100%;
    }
    .controls-bar select {
        width: 100%;
        max-width: none;
    }
    .modal-content {
        width: 95%;
        margin: 20% auto;
        padding: 20px;
    }
}

/* Folder Tree View Styles */
.folder-tree {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 24px;
}

.folder-tree-item {
    margin: 4px 0;
}

.folder-tree-item-content {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    user-select: none;
}

.folder-tree-item-content:hover {
    background-color: #f1f5f9;
}

.folder-tree-item-content.active {
    background-color: #e0f2fe;
    color: #0284c7;
    font-weight: 500;
}

.folder-tree-item-content.selected {
    background-color: #dbeafe;
    border-left: 3px solid #0284c7;
}

.folder-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    background: none;
    border: none;
    color: #475569;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
}

.folder-toggle.expanded::before {
    content: "▼";
}

.folder-toggle.collapsed::before {
    content: "▶";
}

.folder-icon {
    margin-right: 6px;
    font-size: 1rem;
}

.folder-name {
    flex: 1;
    color: inherit;
}

.folder-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.folder-tree-item-content:hover .folder-actions {
    opacity: 1;
}

.folder-edit-btn, .folder-delete-btn {
    background: none;
    border: none;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #64748b;
    transition: color 0.2s ease;
}

.folder-edit-btn:hover {
    color: #0284c7;
}

.folder-delete-btn:hover {
    color: #ef4444;
}

.folder-children {
    margin-left: 20px;
    padding-left: 12px;
    border-left: 1px solid #cbd5e1;
}

.folder-children.hidden {
    display: none;
}

.folder-tab-add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #e2e8f0;
    border: none;
    color: #475569;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.folder-tab-add:hover {
    background: #cbd5e1;
}
