* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --accent: #e74c3c;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --success: #27ae60;
    --warning: #f39c12;
    --gray: #7f8c8d;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 30px 0;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, 0.2);
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    color: var(--primary);
}

.profile-text h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

.profile-text p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.stats {
    display: flex;
    gap: 30px;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 25px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Controls */
.controls {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    flex: 1;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
}

select, input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: white;
    transition: all 0.3s;
}

select:focus, input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--secondary);
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #219653;
    transform: translateY(-2px);
}

.btn-warning {
    background-color: var(--warning);
    color: white;
}

.btn-warning:hover {
    background-color: #e67e22;
    transform: translateY(-2px);
}

.file-controls {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

/* Book Grid */
.book-count {
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: var(--dark);
}

.book-count span {
    font-weight: bold;
    color: var(--secondary);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.book-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.book-cover {
    height: 220px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-cover-placeholder {
    text-align: center;
    color: var(--gray);
    padding: 20px;
}

.book-cover-placeholder i {
    font-size: 70px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.upload-cover-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--dark);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.upload-cover-btn:hover {
    background: white;
    transform: scale(1.1);
}

.book-info {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--dark);
    line-height: 1.4;
}

.book-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f8f9fa;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--gray);
}

.author-position {
    background-color: rgba(52, 152, 219, 0.1);
    color: var(--secondary);
    font-weight: 600;
}

.first-author {
    background-color: rgba(231, 76, 60, 0.1);
    color: var(--accent);
}

.editor-role {
    background-color: rgba(243, 156, 18, 0.1);
    color: var(--warning);
}

.book-details {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.book-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.action-btn {
    flex: 1;
    padding: 8px 15px;
    text-align: center;
    background-color: #f8f9fa;
    border-radius: 6px;
    color: var(--dark);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.action-btn:hover {
    background-color: var(--secondary);
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: var(--primary);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.3rem;
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s;
}

.close-modal:hover {
    transform: scale(1.2);
}

.modal-body {
    padding: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.modal-footer {
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: var(--gray);
    grid-column: 1 / -1;
}

.loading i {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--secondary);
    animation: spin 2s linear infinite;
}

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

/* Error */
.error {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: var(--accent);
    grid-column: 1 / -1;
}

.error i {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--accent);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--gray);
    grid-column: 1 / -1;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #ccc;
}

/* Footer */
footer {
    background: var(--dark);
    color: white;
    padding: 30px 0;
    border-radius: 15px 15px 0 0;
    margin-top: 50px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.external-links {
    display: flex;
    gap: 20px;
}

.external-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.3s;
}

.external-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

/* Responsive */
@media (max-width: 1100px) {
    .header-content {
        flex-direction: column;
        gap: 30px;
        text-align: center;
    }
    
    .profile-info {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
    }
    
    .file-controls {
        align-self: flex-start;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .stats {
        flex-wrap: wrap;
        justify-content: center;
    }
}