/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, system-ui, sans-serif; background: #f5f5f5; padding: 16px; }
h1 { text-align: center; margin-bottom: 16px; font-size: 1.4em; }

/* User selection */
.user-select { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 80px; flex-direction: column; }
.user-select h2 { font-size: 1.2em; color: #333; margin-bottom: 8px; }
.user-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.user-btn { padding: 16px 36px; border: 2px solid #1a73e8; border-radius: 12px; background: #fff; font-size: 1.1em; font-weight: 600; cursor: pointer; color: #1a73e8; transition: all .15s; }
.user-btn:hover { background: #1a73e8; color: #fff; }

/* User bar */
.user-bar { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-bar .current-user { font-weight: 600; font-size: .95em; }
.user-bar .book-count { font-size: .85em; color: #888; }
.user-bar button { padding: 4px 12px; border: 1px solid #ccc; border-radius: 6px; background: #fff; font-size: .8em; cursor: pointer; }

/* Controls */
.controls { text-align: center; margin-bottom: 12px; max-width: 900px; margin-left: auto; margin-right: auto; display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
.controls button { padding: 6px 14px; border: 1px solid #ccc; border-radius: 6px; background: #fff; font-size: .8em; cursor: pointer; }
.controls button.active { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.controls select { padding: 6px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: .8em; background: #fff; }
.controls label { font-size: .8em; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.controls label input { cursor: pointer; }

/* Add button */
.add-btn { position: fixed; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; background: #1a73e8; color: #fff; border: none; font-size: 1.5em; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.3); z-index: 10; }

/* Burger menu */
.burger-menu { position: fixed; top: 16px; right: 70px; width: 40px; height: 40px; background: none; border: none; cursor: pointer; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; z-index: 10; }
.burger-menu span { width: 24px; height: 2px; background: #333; display: block; transition: all .3s; }
.burger-menu.open span:nth-child(1) { transform: rotate(45deg) translate(8px, 8px); }
.burger-menu.open span:nth-child(2) { opacity: 0; }
.burger-menu.open span:nth-child(3) { transform: rotate(-45deg) translate(7px, -7px); }

.menu-dropdown { position: fixed; top: 65px; right: 16px; background: #fff; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.15); z-index: 10; min-width: 150px; display: none; }
.menu-dropdown.open { display: block; }
.menu-dropdown button { display: block; width: 100%; padding: 12px 16px; border: none; background: none; text-align: left; font-size: .9em; cursor: pointer; transition: background .15s; }
.menu-dropdown button:hover { background: #f0f0f0; }
.menu-dropdown button:first-child { border-radius: 8px 8px 0 0; }
.menu-dropdown button:last-child { border-radius: 0 0 8px 8px; }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; justify-content: center; align-items: center; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 20px; width: 300px; box-shadow: 0 4px 20px rgba(0,0,0,.2); }
.modal h2 { font-size: 1em; margin-bottom: 12px; }
.modal input { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 6px; font-size: .9em; margin-bottom: 8px; }
.modal .modal-btns { display: flex; gap: 8px; }
.modal .modal-btns button { flex: 1; padding: 8px; border: 1px solid #ccc; border-radius: 6px; font-size: .85em; cursor: pointer; }
.modal .modal-btns .submit { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.modal .status { font-size: .8em; margin-top: 8px; }

/* Card grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; max-width: 1400px; margin: 0 auto; }
.card { background: #fff; border-radius: 8px; padding: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.12); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.card.hidden { display: none; }
.card img { width: 100%; max-width: 140px; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px; margin-bottom: 6px; background: #e0e0e0; }
.card .title { font-weight: 600; font-size: .85em; text-align: center; }
.card .author { font-size: .75em; color: #555; text-align: center; margin: 2px 0 4px; }
.card .loc { font-size: .85em; color: #000; text-align: center; line-height: 1.3; margin-bottom: 6px; }
.rozet-link { display: flex; align-items: center; width: 18px; height: 23px; opacity: .6; transition: opacity .15s; }
.rozet-link:hover { opacity: 1; }
.rozet-link img { width: 100%; height: 100%; background: transparent; }

/* Card actions & tags */
.card-actions { margin-top: auto; padding-top: 4px; display: flex; flex-direction: row; align-items: center; justify-content: space-evenly; gap: 8px; width: 100%; }
.tag-buttons { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.tag-btn { padding: 2px 8px; border-radius: 10px; font-size: .65em; font-weight: 600; cursor: pointer; border: 1.5px solid; background: #fff; transition: all .15s; }
.tag-btn.mark-btn { border-color: #1a73e8; color: #1a73e8; font-size: .85em; padding: 4px 10px; }
.tag-btn.mark-btn:hover { background: #1a73e8; color: #fff; }
.delete-btn { border-color: #999; color: #999; font-size: .85em; padding: 4px 10px; }
.delete-btn:hover { background: #999; color: #fff; }
.tag-btn.ivan { border-color: #4caf50; color: #4caf50; }
.tag-btn.ivan.tagged { background: #4caf50; color: #fff; }
.tag-btn.mira { border-color: #e91e63; color: #e91e63; }
.tag-btn.mira.tagged { background: #e91e63; color: #fff; }

/* Tag badges */
.tag-badges { margin-top: 3px; display: flex; gap: 3px; justify-content: center; }
.tag-badge { padding: 1px 6px; border-radius: 8px; font-size: .6em; font-weight: 600; color: #fff; }
.tag-badge.ivan { background: #4caf50; }
.tag-badge.mira { background: #e91e63; }

/* Loading */
.loading { text-align: center; padding: 40px; color: #888; font-size: .9em; }
