/* GLOBAL */

:focus-visible {
    outline: 2px solid #19747d !important;
    outline-offset: 2px;
    box-shadow: none !important;
}

.ext-link-icon {
    display: inline-block;
    vertical-align: middle;
    margin-left: 3px;
}


/* LAYOUT */

body {
    background: #f0f0f0;
}

.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e2e2e2;
}

.app-header .wordmark {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.app-header .wordmark .blog {
    color: #19747d;
}

.app-header .wordmark .buddy {
    color: #f06d0d;
}

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

.app-header nav a:link,
.app-header nav a:visited {
    color: #bd4b00;
    text-decoration: none;
    font-size: 0.95rem;
}

.app-header nav a:hover {
    color: #111;
}

.app-header h1 {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
}


/* FORM INPUTS */

input,
textarea,
select {
    background: white;
}

input::placeholder,
textarea::placeholder {
    color: #aaa;
}

input:focus,
textarea:focus,
select:focus {
    --pico-border-color: #19747d;
    border-color: #19747d;
}


/* BUTTONS */

button,
[type="submit"],
[type="button"] {
    --pico-primary-background: #19747d;
    --pico-primary-border: #19747d;
    --pico-primary-hover-background: #156068;
    --pico-primary-hover-border: #156068;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.file-upload-btn {
    display: inline-block;
    background: #19747d;
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: var(--pico-border-radius);
    cursor: pointer;
}

.file-upload-btn:hover {
    background: #156068;
}


/* TABS */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--pico-muted-border-color);
    margin-bottom: 1rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 4px solid transparent;
    cursor: pointer;
    margin: 0;
    color: #555;
    outline: none;
    box-shadow: none;
}

.tab:hover {
    background: #f5f5f5;
    color: #111;
    outline: none;
    box-shadow: none;
}

.tab:focus-visible {
    outline: 2px solid #19747d;
    outline-offset: 2px;
    box-shadow: none;
}

.tab.active {
    border-bottom-color: #f87924;
    color: #111;
    background: #f5f5f5;
    outline: none;
    box-shadow: none;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}


/* FORM LAYOUT HELPERS */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.button-group {
    margin: 1.5rem 0;
    text-align: center;
}

.button-group button {
    margin: 0 0.5rem;
}


/* STATUS MESSAGES */

.status {
    display: none;
    padding: 1rem;
    border-radius: var(--pico-border-radius);
    margin: 1rem 0;
}

.status.success {
    display: block;
    background: #d4edda;
    color: #155724;
}

.status.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
}

.status.info {
      display: block;
      background: #f0f4f5;
      color: #555;
  }


/* SECTIONS */

.step-box {
    border: none;
    padding: 1rem;
    margin-bottom: 0;
    background: white;
}

.step-box + .step-box {
    border-top: 2px solid #eee;
}

.step-header {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 1.1rem;
}


/*  TOGGLE BUTTON GROUP */

.toggle-group {
    display: inline-flex;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    overflow: hidden;
}

.toggle-btn {
    cursor: pointer;
    margin: 0;
}

.toggle-btn input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.toggle-btn input:focus-visible + span {
    outline: 2px solid #19747d;
    outline-offset: 2px;
}

.toggle-btn span {
    display: block;
    padding: 0.5rem 1rem;
    background: white;
    border-right: 1px solid var(--pico-muted-border-color);
    font-size: 0.9rem;
}

.toggle-btn:last-child span {
    border-right: none;
}

.toggle-btn input:checked + span {
    background: #19747d;
    color: white;
}

.toggle-btn:hover span {
    background: white;
}

.toggle-btn input:checked:hover + span {
    background: #156068;
}

.grey-toggle .toggle-btn input:checked + span {
    background: var(--pico-secondary-background);
    color: var(--pico-secondary-inverse);
}

.grey-toggle .toggle-btn input:checked:hover + span {
    background: var(--pico-secondary-hover-background);
}


/* CONTENT BOX */

.content-box {
    padding: 1rem;
    background: #f7f9fb;
    border: 1px solid #ddd;
    border-radius: var(--pico-border-radius);
    margin-bottom: 1rem;
}

.content-box h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: #555;
    font-size: 0.95rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}


/* LINK / BOOK ENTRIES */

.link-entry {
    padding: 1rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: var(--pico-border-radius);
    margin-bottom: 1rem;
    position: relative;
}

.link-entry h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: #555;
    font-size: 0.95rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.books-import-container {
    padding: 1rem;
    background: #dee9f4;
    border: 1px solid #ddd;
    border-radius: var(--pico-border-radius);
    margin-bottom: 1rem;
}

.books-import-container h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: #555;
    font-size: 0.95rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.import-toggle-btn {
    padding: 0.45rem 1.1rem;
    font-size: 0.95rem;
    margin: 0.75rem 0;
}

.add-link-btn {
    background: none;
    border: none;
    color: #b54500;
    padding: 0;
    font-weight: bold;
}

.add-link-btn:hover {
    text-decoration: underline;
    background: none;
}

.remove-link-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

#url-import-section h2,
#ics-import-section h2,
#isbn-fetch-section h2 {
    font-size: 1.25rem;
}

h2.card-number {
    font-size: 1.5rem;
}


/* PREVIEW SECTION */

.preview-section {
    display: none;
    margin: 2rem 0;
    padding: 1.5rem;
    border: 3px solid #19747d;
    border-radius: var(--pico-border-radius);
    background: white;
}

.preview-section.show {
    display: block;
}

.preview-container {
    max-height: 600px;
    overflow-y: auto;
    padding: 1rem;
    background: white;
}

textarea.code {
    font-family: monospace;
    font-size: 0.85rem;
}


/* PREVIEW CONTENT: BOOKS */

.preview-container .book-item {
    padding: 20px;
    margin-bottom: 25px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #ffffff;
    clear: both;
}

.preview-container .book-item p {
    margin: 10px 0;
}

.preview-container .book-item-odd {
    background-color: #f9f9f9;
}

.preview-container .book-item-even {
    background-color: #ffffff;
}

.preview-container .book-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.preview-container .book-cover {
    flex-shrink: 0;
}

.preview-container .book-cover-img {
    width: 120px;
    height: auto;
    border-radius: 4px;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
}

.preview-container .book-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preview-container .book-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview-container .book-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    line-height: 1.3;
}

.preview-container .book-author {
    color: #333;
    font-size: 1rem;
}

.preview-container .book-description {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
    margin-top: 4px;
}

.preview-container .book-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-container .book-details {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.6;
}

.preview-container .book-view-btn {
    display: inline-block;
    background-color: #19747d;
    color: white !important;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.95rem;
    transition: background-color 0.3s;
    width: fit-content;
}

.preview-container .book-view-btn:hover {
    background-color: #156068;
    color: white;
    text-decoration: underline;
}


/* PREVIEW CONTENT: EVENTS */

.preview-container .event-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    margin-bottom: 20px;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
}

.preview-container .event-date-box {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    background: #19747d;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

.preview-container .event-day {
    font-size: 2rem;
    font-weight: bold;
    line-height: 1;
}

.preview-container .event-month {
    font-size: 0.9rem;
    text-transform: uppercase;
    margin-top: 4px;
    letter-spacing: 1px;
}

.preview-container .event-content {
    flex: 1;
}

.preview-container .event-title {
    font-size: 1.4rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.preview-container .event-meta {
    color: #333;
    font-size: 0.95rem;
    margin-bottom: 12px;
    line-height: 1.6;
}

.preview-container .event-meta-item {
    margin-bottom: 4px;
}

.preview-container .event-meta strong {
    color: #555;
    margin-right: 5px;
}

.preview-container .event-description {
    line-height: 1.6;
    margin-bottom: 15px;
    color: #555;
}

.preview-container .event-link {
    color: #bd4b00 !important;
    text-decoration: none;
    font-weight: bold;
}

.preview-container .event-link:hover {
    color: #bd4b00;
    text-decoration: underline;
}


/* PREVIEW CONTENT: LINKS */

.preview-container .link-section {
    margin-bottom: 30px;
}

.preview-container .link-section-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.preview-container .link-item {
    padding: 15px;
    margin-bottom: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background-color: #ffffff;
    transition: all 0.3s;
}

.preview-container .link-item:hover {
    border-color: #ccc;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.preview-container .link-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.preview-container .link-title a {
    color: #bd4b00;
    text-decoration: none;
}

.preview-container .link-title::before {
    content: "🔗 ";
    margin-right: 8px;
}

.preview-container .link-title a:hover {
    text-decoration: underline;
}

.preview-container .link-description {
    color: #555;
    line-height: 1.5;
}


/* PREVIEW CONTENT: BOOK GRID */

.preview-container .book-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    justify-content: flex-start;
}

.preview-container .book-grid-item {
    width: 150px;
    text-align: center;
}

.preview-container .book-grid-cover {
    margin-bottom: 10px;
}

.preview-container .book-grid-cover img {
    width: 120px;
    height: auto;
    border-radius: 4px;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.preview-container .book-grid-cover img:hover {
    transform: translateY(-3px);
    box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.3);
}

.preview-container .book-grid-cover a {
    display: block;
}

.preview-container .book-grid-title {
    font-weight: bold;
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 5px;
    line-height: 1.3;
}

.preview-container .book-grid-title a {
    color: #bd4b00;
    text-decoration: none;
    font-weight: bold;
}

.preview-container .book-grid-title a:hover {
    text-decoration: underline;
}

.preview-container .book-grid-author {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 8px;
}


/* BLOG POSTS TAB */

.blog-post-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.85rem 0.5rem;
    border-bottom: 1px solid #eee;
}

.blog-post-row:last-child {
    border-bottom: none;
}

.blog-post-thumb {
    width: 80px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.blog-post-thumb-placeholder {
    width: 80px;
    height: 56px;
    border-radius: 4px;
    flex-shrink: 0;
    background: #e8eef2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 1.4rem;
}

.blog-post-info {
    flex: 1;
    min-width: 0;
}

.blog-post-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #111;
    margin-bottom: 0.15rem;
    line-height: 1.3;
}

.blog-post-title a:link,
.blog-post-title a:visited {
    color: #bd4b00;
    text-decoration: none;
}

.blog-post-title a:hover {
    text-decoration: underline;
}

.blog-post-meta {
    font-size: 0.8rem;
    color: #555;
    margin-bottom: 0.2rem;
}

.blog-post-excerpt {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.4;
}

.blog-btn-stack {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-shrink: 0;
    align-self: flex-start;
}

.blog-copy-btn {
    flex-shrink: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: var(--pico-border-radius);
    padding: 0.4rem 0.7rem;
    cursor: pointer;
    color: #555;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    white-space: nowrap;
    align-self: flex-start;
    box-shadow: none;
}

.blog-copy-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
    color: #333;
    box-shadow: none;
}

.blog-copy-btn.copied {
    border-color: #19747d;
    color: #19747d;
    background: #f0fafa;
}


/* HELP PAGE */

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: #19747d;
    font-size: 0.9rem;
    text-decoration: none;
}

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

.help-content h2 {
    font-size: 1.4rem;
    color: #19747d;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.4rem;
}

.help-content h3 {
    font-size: 1.1rem;
    color: #333;
    margin-top: 1.5rem;
    margin-bottom: 0.4rem;
}

.help-content p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #444;
}

.help-content ul {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #444;
    padding-left: 1.5rem;
}

.help-content li {
    margin-bottom: 0.25rem;
}

.help-content .tip {
    background: #dee9f4;
    border-left: 4px solid #19747d;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: #333;
}

.help-content .step-list {
    counter-reset: steps;
    list-style: none;
    padding-left: 0;
}

.help-content .step-list li {
    counter-increment: steps;
    padding: 0.6rem 0 0.6rem 2.5rem;
    position: relative;
    border-bottom: 1px solid #f0f0f0;
}

.help-content .step-list li::before {
    content: counter(steps);
    position: absolute;
    left: 0;
    top: 0.5rem;
    background: #19747d;
    color: white;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

code {
    background: #f0f0f0;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
    color: #333;
}
