:root {
    /* Color Palette */
    --primary-color: #1e3a8a;
    /* Deep Royal Blue */
    --secondary-color: #db2777;
    /* Deep Rose/Magenta - Feminine accent */
    --accent-color: #f59e0b;
    /* Amber/Gold */
    --bg-color: #f8fafc;
    /* Light Blue-Grey */
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;

    /* Spacing & Borders */
    --radius-lg: 16px;
    --radius-md: 8px;
    --radius-sm: 4px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(30, 58, 138, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(219, 39, 119, 0.05) 0px, transparent 50%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.main-header {
    margin-bottom: 2rem;
    padding: 1rem 0;
    text-align: center;
    position: relative;
}

.logo-area {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.logo-img {
    height: 80px;
    /* Adjust size */
    width: auto;
    object-fit: contain;
}

.header-text h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
    line-height: 1.2;
}

.header-text .subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Search Section - Glassmorphism */
.search-section {
    margin-bottom: 2rem;
}

.search-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.6));
}

.search-card h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.search-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Inputs */
.input-group {
    position: relative;
    width: 100%;
}

.search-bar-group {
    flex-grow: 1;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

input[type="text"],
select {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-family: inherit;
}

select {
    padding-left: 1rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.filters-row {
    display: flex;
    gap: 1rem;
}

.select-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.select-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Results Section */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.results-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.refresh-btn.spinning svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Table Design */
.table-container {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow-x: auto;
    /* Responsive Scroll */
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    /* Force scroll on small screens */
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: #f1f5f9;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(30, 58, 138, 0.02);
}

/* Table Cell Styling */
.book-title {
    font-weight: 600;
    color: var(--primary-color);
    text-transform: capitalize;
    /* Fixes all-caps data */
}

.book-title-tamil {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.5;
    /* Tamil script needs proper font rendering */
}

.book-author {
    color: var(--text-primary);
    text-transform: capitalize;
    /* Fixes all-caps data */
}

.book-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-available {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-unavailable {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Highlighting */
.highlight {
    background-color: #fef08a;
    /* Yellow highlight */
    color: var(--text-primary);
    padding: 0 2px;
    border-radius: 2px;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.no-results-img {
    width: 150px;
    height: auto;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.hidden {
    display: none;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1.5rem;
}

.pagination-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0 1rem;
}

/* Footer */
footer {
    margin-top: auto;
    padding-top: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive */
@media (min-width: 768px) {
    .search-controls {
        flex-direction: row;
        align-items: flex-end;
    }

    .search-bar-group {
        flex: 2;
    }

    .filters-row {
        flex: 1;
    }
}

@media (max-width: 640px) {
    .header-text h1 {
        font-size: 1.25rem;
    }

    .logo-area {
        flex-direction: column;
        padding: 1rem;
        width: 100%;
    }

    .filters-row {
        flex-direction: column;
    }

    /* Mobile Card Layout for Table if needed, but horizontal scroll is often cleaner for complex data */
}