/* Web 1.0 / Windows 98 Style CSS - Public Catalog */
body {
    font-family: "MS Sans Serif", Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #008080; /* Windows Desktop Teal */
    color: #000;
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* The Main "Program Window" */
.window-container {
    background-color: #c0c0c0;
    border: 3px outset #ffffff;
    box-shadow: 5px 5px 0px #000;
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px; 
}

/* Title Bar Styling */
header {
    background: #000080;
    padding: 4px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #c0c0c0;
    margin: 3px;
}

header h1 {
    margin: 0;
    font-size: 16px;
    color: #fff;
    font-weight: bold;
    letter-spacing: 1px;
    font-family: sans-serif;
}

/* Fake Title Bar Controls */
.window-controls {
    display: flex;
    gap: 4px;
}

.window-btn {
    width: 16px;
    height: 14px;
    background-color: #c0c0c0;
    border: 2px outset #ffffff;
    font-size: 10px;
    line-height: 10px;
    text-align: center;
    font-weight: bold;
    cursor: pointer;
}

.window-btn:active {
    border: 2px inset #ffffff;
}

/* Main Content Area */
main {
    padding: 15px;
    flex: 1;
}

h2 {
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 15px;
    color: #000;
    border: none;
    text-shadow: 1px 1px #fff;
}

/* Horizontal Rule */
hr {
    border: 0;
    border-top: 1px solid #808080;
    border-bottom: 1px solid #ffffff;
    margin: 15px 0;
}

/* --- FORM ELEMENTS --- */
.search-form {
    padding: 10px;
    border: 2px groove #ffffff;
    margin-bottom: 20px;
}

input[type="text"], select {
    background-color: #fff;
    border: 2px inset #ffffff;
    padding: 4px;
    font-family: "MS Sans Serif", Arial, sans-serif;
    font-size: 13px;
    color: #000;
}

button, .pagination-button {
    background-color: #c0c0c0;
    color: #000;
    border: 2px outset #ffffff;
    padding: 4px 12px;
    cursor: pointer;
    font-family: "MS Sans Serif", Arial, sans-serif;
    font-size: 13px;
    text-decoration: none;
    display: inline-block;
}

button:active, .pagination-button:active {
    border: 2px inset #ffffff;
    padding: 5px 11px 3px 13px;
}

.pagination-button.disabled {
    color: #808080;
    border: 2px solid #c0c0c0;
    text-shadow: 1px 1px #fff;
    cursor: default;
}

/* --- VIEW TOGGLE BUTTONS --- */
.view-btn {
    margin-left: 5px;
    width: 40px; 
    text-align: center;
}

.view-btn.active {
    background-color: #e0e0e0;
    border: 2px inset #ffffff;
    font-weight: bold;
    cursor: default;
}

/* --- TABLE STYLING --- */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 2px inset #ffffff;
    background-color: #fff;
    margin: 20px 0;
}

th {
    background-color: #c0c0c0;
    color: #000;
    padding: 6px;
    text-align: left;
    border: 1px solid #808080;
    border-top: 2px outset #ffffff;
    border-left: 2px outset #ffffff;
    font-size: 13px;
    font-weight: normal;
}

td {
    padding: 10px;
    border-bottom: 1px dotted #ccc;
    border-right: 1px solid #eee;
    font-size: 13px;
    vertical-align: top;
}

/* Thumbnail Styling */
.book-cover-thumbnail {
    max-width: 100px;
    max-height: 150px;
    border: 2px inset #ffffff;
    display: block;
}

td.cover-cell {
    width: 120px;
    text-align: center;
}

/* ROW INTERACTION STYLES */
tbody tr {
    cursor: pointer;
}

tbody tr:hover {
    background-color: #000080;
    color: #fff;
}

tbody tr:hover a {
    color: #fff;
}

/* --- GRID VIEW STYLING --- */
.book-grid {
    display: grid;
    /* 6 Columns as requested */
    grid-template-columns: repeat(6, 1fr); 
    gap: 20px;
    padding: 10px;
    margin-top: 10px;
}

.grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    cursor: pointer;
    padding: 10px;
    border: 1px dotted transparent;
}

.grid-item:hover {
    border: 1px dotted #000;
    background-color: #dcdcdc;
}

.grid-cover-img {
    width: 100%;
    height: auto;
    max-width: 140px;
    aspect-ratio: 2/3;
    object-fit: cover;
    border: 2px inset #ffffff;
    background-color: #fff;
}

.grid-title {
    margin-top: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    line-height: 1.3;
    max-width: 150px;
}

/* Use relative positioning in grid item for modal anchoring logic */
.grid-item .cover-container {
    position: relative; 
    width: 100%;
    display: flex;
    justify-content: center;
}

/* --- HOVER CARD (CENTERED MODAL) --- */
.hover-card {
    display: none;
}

/* When Active: Fixed Center Positioning */
.cover-container.active .hover-card {
    display: flex;
    flex-direction: column;
    
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    
    background-color: #c0c0c0;
    border: 3px outset #ffffff;
    box-shadow: 10px 10px 0px #000;
    padding: 3px;
    
    width: 600px;
    max-width: 90%;
    max-height: 90vh;
    color: #000; /* Reset text color */
    cursor: default; /* Reset cursor inside the modal */
    text-align: left; /* Ensure text is left aligned even if parent is center */
}

.hover-card-inner {
    display: flex;
    border: 1px solid #808080;
    padding: 15px;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
}

.hover-card-header {
    background: #000080;
    color: white;
    padding: 4px 8px;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hover-card-cover {
    max-width: 200px;
    border: 2px inset #ffffff;
    margin-right: 20px;
    height: auto;
    align-self: flex-start;
}

.hover-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.hover-card-author {
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 14px;
}

.hover-card-description {
    background-color: #fff;
    border: 2px inset #ffffff;
    padding: 10px;
    overflow-y: auto;
    max-height: 250px;
    font-size: 13px;
    line-height: 1.4;
}

/* --- EXTERNAL FOOTER --- */
.external-footer {
    text-align: center;
    color: #fff;
    font-size: 14px;
    font-style: italic;
    text-shadow: 1px 1px 0 #000;
    max-width: 800px;
    margin: 0 auto;
}

/* Links */
a { color: #000080; }
a:hover { text-decoration: none; }