:root {
    --primary-color: #4f46e5;         /* Indigo */
    --primary-hover: #4338ca;
    --bg-color: #f8fafc;              /* Soft light slate */
    --card-bg: #ffffff;
    --text-color: #1e293b;            /* Dark slate */
    --text-secondary: #64748b;        /* Cool gray */
    --border-color: #e2e8f0;
    --input-bg: #f1f5f9;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

/* Container for centering content */
.container {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

/* Card layout wrapper */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

form {
    width: 100%;
}

/* Search input style */
.search {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--text-color);
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease-in-out;
    margin-bottom: 1rem;
}

.search:focus {
    outline: none;
    background-color: var(--card-bg);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.search:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Buttons */
input.submit, button.sendbtn, .btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

input.submit, button.sendbtn {
    background-color: var(--primary-color);
    color: #ffffff;
    margin-right: 0.5rem;
    margin-top: 0.5rem;
}

input.submit:hover, button.sendbtn:hover {
    background-color: var(--primary-hover);
}

input.submit:disabled, button.sendbtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Action button row styling */
.button-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 1rem;
}

/* Google sign-in container */
.g-signin2 {
    display: inline-block;
    margin-bottom: 1rem;
}

/* Book lists */
div.list {
    width: 100%;
    margin-top: 1.5rem;
}

ol.booklist {
    list-style: none;
}

ol.booklist li {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

ol.booklist li:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

ol.booklist li a.details {
    display: block;
    padding: 1rem;
    color: var(--text-color);
    font-weight: 500;
    text-decoration: none;
}

/* Details Page */
span.author {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1rem;
    line-height: 1.25;
}

div.description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
}

/* Download chips */
.download_links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

a.epub, a.fb2zip, a.html, a.mobi {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.15s ease-in-out;
}

a.epub:hover, a.fb2zip:hover, a.html:hover, a.mobi:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: #ffffff;
}

/* MOBI converter division */
.mobi_data {
    margin-top: 1.5rem;
    border-top: 1px dashed var(--border-color);
    padding-top: 1.5rem;
}

.mobi_data p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.mobi_data label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.mobi_data input[type="email"] {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--input-bg);
    margin-bottom: 0.75rem;
}

.mobi_data input[type="email"]:focus {
    outline: none;
    background-color: var(--card-bg);
    border-color: var(--primary-color);
}

/* Wait log styling */
.log {
    font-family: 'Fira Code', 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    background-color: #1e293b;   /* slate-800 for contrast console look */
    color: #38bdf8;             /* sky-400 */
    padding: 1.5rem;
    border-radius: var(--radius-md);
    height: 350px;
    overflow-y: auto;
    border: 1px solid #334155;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
}

#not_allowed_div {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* CSS Loader spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 1.5rem auto;
}

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

/* Responsive next-page link button */
a.next-page {
    display: block;
    text-align: center;
    padding: 0.75rem;
    margin-top: 1.5rem;
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

a.next-page:hover {
    background-color: var(--primary-color);
    color: #ffffff;
}