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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 2rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 2px;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

section {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

section h2 {
    color: #667eea;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

/* Form Styles */
form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

form div {
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 600;
    color: #555;
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="number"] {
    padding: 0.8rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input[type="checkbox"] {
    transform: scale(1.2);
    margin-right: 0.5rem;
}

/* Button Styles */
button {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

button[type="submit"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-top: 1rem;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Book List Styles */
.bookshelf-container {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

#incompleteBookList,
#completeBookList {
    min-height: 200px;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px dashed #ddd;
}

/* Book Item Styles */
[data-testid="bookItem"] {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    border-left: 4px solid #667eea;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

[data-testid="bookItem"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

[data-testid="bookItemTitle"] {
    color: #333;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

[data-testid="bookItemAuthor"],
[data-testid="bookItemYear"] {
    color: #666;
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
}

/* Book Action Buttons */
[data-testid="bookItem"] > div {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

[data-testid="bookItemIsCompleteButton"] {
    background: #28a745;
    color: white;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}

[data-testid="bookItemIsCompleteButton"]:hover {
    background: #218838;
    transform: translateY(-1px);
}

[data-testid="bookItemDeleteButton"] {
    background: #dc3545;
    color: white;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}

[data-testid="bookItemDeleteButton"]:hover {
    background: #c82333;
    transform: translateY(-1px);
}

[data-testid="bookItemEditButton"] {
    background: #ffc107;
    color: #212529;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}

[data-testid="bookItemEditButton"]:hover {
    background: #e0a800;
    transform: translateY(-1px);
}

/* Search Form */
#searchBook {
    flex-direction: row;
    align-items: end;
    gap: 1rem;
}

#searchBook div {
    flex: 1;
}

#searchSubmit {
    background: #17a2b8;
    color: white;
    white-space: nowrap;
}

#searchSubmit:hover {
    background: #138496;
}

/* Responsive Design */
@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
        padding: 0 0.5rem;
    }
    
    .bookshelf-container {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    section {
        padding: 1.5rem;
    }
    
    #searchBook {
        flex-direction: column;
        align-items: stretch;
    }
    
    [data-testid="bookItem"] > div {
        flex-direction: column;
    }
    
    [data-testid="bookItem"] button {
        width: 100%;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#searchResults {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

#searchResults h3 {
    color: #495057;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 0.5rem;
}

#searchResultsList {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-result-item {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid;
    position: relative;
}

.search-result-item.incomplete {
    border-left-color: #ffc107;
    background: linear-gradient(90deg, #fff3cd 0%, white 5%);
}

.search-result-item.complete {
    border-left-color: #28a745;
    background: linear-gradient(90deg, #d4edda 0%, white 5%);
}

.search-result-status {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.search-result-status.incomplete {
    background: #ffc107;
    color: #212529;
}

.search-result-status.complete {
    background: #28a745;
    color: white;
}

.search-result-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.3rem;
}

.search-result-details {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.search-result-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-result-actions button {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
}

#clearSearch {
    margin-top: 0.5rem;
}

#clearSearch:hover {
    background: #5a6268 !important;
}

.empty-search {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 2rem;
}