/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Anuphan:wght@400;500;600;700&display=swap');

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Anuphan', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #ECF3F9;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Header Navigation */
.header-nav {
    background-color: #FFFFFF;
    border-radius: 0 0 24px 24px;
    padding: 20px 16px;
    display: flex;
    align-items: center;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    z-index: 10;
    height: 8vh;
}

.header-nav-back-btn {
    width: 36px;
    height: 36px;
    background-color: #22A3FF;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    text-decoration: none;
    position: absolute;
    left: 16px;
}

.header-nav-title {
    flex: 1;
    text-align: center;
    font-family: 'Anuphan', sans-serif;
    font-weight: 600;
    font-size: 18px;
    color: #333;
}

/* App Container */
.app-container {
    height: 100vh;
    position: relative;
    background-color: #ECF3F9;
    display: flex;
    flex-direction: column;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: unset;
}

/* Bottom Navigation */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #FFFFFF;
    box-shadow: 0px 4px 5px 0px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 4px;
    margin: 10px;
}

.nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
}

/* Navigation Items */
.nav-item {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.nav-item a {
    text-decoration: none;
    color: inherit;
}

.nav-button {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px 5px 5px 5px;
    width: 100%;
    min-height: 60px;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.nav-item.active .nav-button {
    background-color: #22A3FF;
}

.nav-item:not(.active) .nav-button {
    background-color: rgba(239, 236, 244, 0);
}

.nav-button:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease;
}

/* Navigation Icons */
.nav-icon {
    width: 24px;
    height: 24px;
    transition: fill 0.3s ease;
}

.nav-item.active .nav-icon {
    color: #FFFFFF;
}

.nav-item:not(.active) .nav-icon {
    color: #22A3FF;
}

/* Navigation Text */
.nav-text {
    font-family: 'Anuphan', sans-serif;
    font-weight: 500;
    font-size: 12px;
    line-height: 2em;
    text-align: center;
    transition: color 0.3s ease;
}

.nav-item.active .nav-text {
    color: #FFFFFF;
}

.nav-item:not(.active) .nav-text {
    color: #22A3FF;
}


/* Content Styles */
.content-card {
    background-color: #FFFFFF;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.content-title {
    font-family: 'Anuphan', sans-serif;
    font-weight: 600;
    font-size: 18px;
    color: #333;
    margin-bottom: 12px;
}

.content-text {
    font-family: 'Anuphan', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: 'Anuphan', sans-serif;
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    min-height: 44px;
}

.btn-primary {
    background-color: #22A3FF;
    color: #FFFFFF;
}

.btn-primary:hover {
    background-color: #1a8fe6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 163, 255, 0.3);
}

.btn-secondary {
    background-color: rgba(239, 236, 244, 0);
    color: #22A3FF;
    border: 1px solid #22A3FF;
}

.btn-secondary:hover {
    background-color: #22A3FF;
    color: #FFFFFF;
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-family: 'Anuphan', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    font-family: 'Anuphan', sans-serif;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background-color: #FFFFFF;
}

.form-input:focus {
    outline: none;
    border-color: #22A3FF;
    box-shadow: 0 0 0 2px rgba(34, 163, 255, 0.1);
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #E0E0E0;
    border-top: 2px solid #22A3FF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-16 {
    margin-top: 16px;
}

.mb-16 {
    margin-bottom: 16px;
}

.hidden {
    display: none;
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Search Results Page Specific Styles */

.search-count-text {
    font-family: 'Anuphan', sans-serif;
    font-size: 14px;
    color: #4A5568;
    margin-bottom: 12px;
    padding: 0 4px;
    font-weight: 500;
}

.book-card {
    background-color: #FFFFFF;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    gap: 16px;
    border: 1px solid #E2E8F0;
}

.book-cover {
    width: 100px;
    flex-shrink: 0;
}

.book-cover img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #E2E8F0;
}

.book-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-family: 'Anuphan', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #2B6CB0;
    margin-bottom: 8px;
    line-height: 1.3;
}

.book-meta {
    font-family: 'Anuphan', sans-serif;
    font-size: 12px;
    color: #718096;
    margin-bottom: 4px;
}

.book-meta.author {
    margin-bottom: 8px;
    color: #4A5568;
}

.book-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 12px;
}

.btn-book-action {
    max-width: 120px;
    width: 100%;
    background-color: #EBF4FF;
    color: #4A5568;
    border: none;
    border-radius: 6px;
    padding: 6px 0;
    font-family: 'Anuphan', sans-serif;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-book-action:hover {
    background-color: #bee3f8;
}

/* AI Search Page Styles */
.ai-search-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    /* background-color: #044370; */
    border-radius: 12px;
    overflow: hidden;
    margin: 8px;
}

.search-content-area {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.search-input-section {
    background-color: #FFFFFF;
    border: 2px solid #AAAEB1;
    border-radius: 12px;
    margin: 8px;
    padding: 16px;
    box-shadow: 0px 4px 5px 0px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    align-self: center;
    width: calc(100% - 16px);
    margin-top: auto;
    margin-bottom: auto;
    flex-wrap: wrap;
}

.search-input-container {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 12px;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: 'Anuphan', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 2em;
    color: #ADA8A8;
    background: transparent;
    width: 100%;
}

.search-input::placeholder {
    color: #ADA8A8;
}

.search-button {
    width: 40px;
    height: 40px;
    background-color: #22A3FF;
    border: none;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.25);
    transition: all 0.2s ease;
    min-width: 40px;
}

.search-button:hover {
    background-color: #1a8fe6;
    transform: scale(1.05);
}

.plus-button {
    width: 40px;
    height: 40px;
    background-color: #FFFFFF;
    border: 2px solid #22A3FF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.plus-button:hover {
    background-color: #F0F8FF;
    transform: scale(1.05);
    border-color: #1a8fe6;
}

.image-preview-container {
    display: block;
}

.image-preview {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.image-preview img {
    max-height: 130px;
    max-width: 130px;
    border-radius: 8px;
    border: 2px solid #22A3FF;
    object-fit: cover;
}

.remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background-color: #FF4444;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-image:hover {
    background-color: #CC0000;
    transform: scale(1.1);
}

.loading-section {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loading-text {
    font-family: 'Anuphan', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: #FFFFFF;
}

.search-results-section {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    text-align: center;
}

.empty-state-icon {
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state-title {
    font-family: 'Anuphan', sans-serif;
    font-weight: 600;
    font-size: 18px;
    color: #FFFFFF;
    margin-bottom: 8px;
}

.empty-state-text {
    font-family: 'Anuphan', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #CBD5E0;
    line-height: 1.5;
}

/* Override book card styles for AI search theme */
.ai-search-container .book-card {
    background-color: #FFFFFF;
    margin-bottom: 12px;
}

.ai-search-container .search-count-text {
    color: #FFFFFF;
    margin-bottom: 16px;
    font-weight: 500;
}


.ai-search-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100vh - 120px);
}

.search-input-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.search-input-container {
    width: 100%;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(44, 85, 115, 0.362);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #22A3FF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: #ffffff;
    font-size: 16px;
    margin: 0;
}

.search-results-container {
    max-width: 800px;
    margin: auto;
}

/* Share Modal */
.share-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.share-modal {
    background-color: #FFFFFF;
    border-radius: 16px;
    width: 90%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 0;
}

.share-modal-title {
    font-family: 'Anuphan', sans-serif;
    font-weight: 600;
    font-size: 18px;
    color: #333;
}

.share-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.share-modal-close:hover {
    background-color: #f0f0f0;
    color: #333;
}

.share-modal-body {
    padding: 16px 20px 24px;
}

.share-modal-book-title {
    font-family: 'Anuphan', sans-serif;
    font-size: 13px;
    color: #718096;
    margin-bottom: 20px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.share-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 8px;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    background-color: #FFFFFF;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Anuphan', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #4A5568;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.share-btn:active {
    transform: translateY(0);
}

.share-btn-icon {
    width: 28px;
    height: 28px;
}

.share-btn-facebook {
    color: #1877F2;
}

.share-btn-facebook:hover {
    border-color: #1877F2;
    background-color: #F0F8FF;
}

.share-btn-x {
    color: #000;
}

.share-btn-x:hover {
    border-color: #000;
    background-color: #F5F5F5;
}

.share-btn-line {
    color: #06C755;
}

.share-btn-line:hover {
    border-color: #06C755;
    background-color: #F0FFF4;
}

.share-btn-copy {
    color: #22A3FF;
}

.share-btn-copy:hover {
    border-color: #22A3FF;
    background-color: #F0F8FF;
}

.koha-search-footer {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.btn-koha-search {
    display: inline-block;
    background-color: #3182CE;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-family: 'Anuphan', sans-serif;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-koha-search:hover {
    background-color: #2B6CB0;
}

.app-footer {
    text-align: center;
    padding: 12px 16px;
    font-family: 'Anuphan', sans-serif;
    font-size: 14px;
    color: #718096;
}