:root {
    --bg-color: #f3f4f6;
    --text-color: #111827;
    --primary-color: #2563eb;
    --secondary-color: #4b5563;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --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);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 700;
    font-size: 1.5rem;
    text-decoration: none;
    color: var(--primary-color);
    letter-spacing: -0.025em;
}

nav a {
    margin-left: 1.5rem;
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--primary-color);
}

/* Forms */
input[type="text"],
input[type="password"],
textarea,
input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

button,
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background-color: var(--primary-color);
    color: white;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: background-color 0.2s;
}

button:hover,
.btn:hover {
    background-color: #1d4ed8;
}

.btn-danger {
    background-color: #ef4444;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* Grid */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.book-card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-color);
}

.book-card img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
}

.book-info {
    padding: 1rem;
}

.book-title {
    font-weight: 700;
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-author {
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin: 0;
}

/* Detail Page */
.detail-container {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 3rem;
    align-items: start;
}

.detail-cover img {
    width: 100%;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-md);
}

.detail-info h1 {
    margin-top: 0;
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    nav a {
        margin: 0 0.75rem;
    }

    .book-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .detail-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .detail-cover {
        width: 100%;
        max-width: 250px;
        margin: 0 auto;
    }

    .detail-info {
        text-align: left;
    }

    .search-section form {
        flex-direction: column;
    }

    .search-section button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .book-grid {
        grid-template-columns: 1fr;
    }
}

/* Admin Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #f9fafb;
    font-weight: 600;
}

/* Login */
.login-box {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background: var(--card-bg);
    box-shadow: var(--shadow-md);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-color);
    font-size: 0.9rem;
    background-color: var(--card-bg);
}