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

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

header {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

header h1 {
    margin: 0;
}

.back-button {
    position: absolute;
    left: 20px;
    color: white;
    text-decoration: none;
    padding: 5px 10px;
    background-color: #555;
    border-radius: 4px;
}

.back-button:hover {
    background-color: #777;
}

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

#magazine-list {
    flex: 0 0 300px;
    background-color: #fff;
    border-radius: 5px;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin-right: 20px;
}

#magazine-list h2 {
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.magazine-item {
    margin-bottom: 10px;
    cursor: pointer;
    padding: 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.magazine-item:hover {
    background-color: #f0f0f0;
}

.magazine-item.active {
    background-color: #e0e0e0;
    font-weight: bold;
}

.magazine-thumbnail {
    max-width: 100%;
    height: auto;
    display: block;
    margin-bottom: 5px;
    border: 1px solid #ddd;
}

#viewer-container {
    flex: 1;
    background-color: #fff;
    border-radius: 5px;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

#pdf-viewer {
    display: flex;
    flex-direction: column;
    height: 80vh;
    padding: 20px;
}

#pdf-container {
    flex: 1;
    overflow: auto;
    border: 1px solid #ddd;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f9f9f9;
}

#pdf-container canvas {
    max-width: 100%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 10px 0;
    flex-wrap: wrap;
}

.controls button {
    padding: 8px 15px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.controls button:hover {
    background-color: #555;
}

.controls button:disabled {
    background-color: #999;
    cursor: not-allowed;
}

#page-info {
    font-size: 14px;
    margin: 0 10px;
}

/* Zoom controls styling */
.zoom-controls {
    display: flex;
    gap: 5px;
    margin: 0 10px;
}

.zoom-controls button {
    width: 35px;
    height: 35px;
    font-size: 16px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-message {
    color: #d9534f;
    padding: 20px;
    text-align: center;
    font-weight: bold;
}

footer {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    background-color: #333;
    color: #fff;
}

/* Homepage Grid Layout */
.magazine-grid-container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}

.magazine-grid-container h2 {
    margin-bottom: 20px;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

#magazine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.magazine-card {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s;
    text-decoration: none;
    color: inherit;
}

.magazine-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.magazine-cover {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-bottom: 1px solid #eee;
}

.magazine-info {
    padding: 15px;
}

.magazine-title {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.magazine-description {
    font-size: 0.9em;
    color: #666;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    #magazine-list {
        flex: 1;
        margin-right: 0;
        margin-bottom: 20px;
    }
    
    #magazine-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }
    
    .magazine-cover {
        height: 230px;
    }
    
    .viewer-container {
        padding: 0 10px;
    }
    
    #pdf-viewer {
        height: 70vh;
    }
}

@media (max-width: 480px) {
    #magazine-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .magazine-cover {
        height: 200px;
    }
    
    .magazine-info {
        padding: 10px;
    }
    
    .controls {
        flex-direction: column;
        gap: 10px;
    }
}