/* Core resets */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background-color: #0f172a; color: #f8fafc; padding: 20px;
}

/* Header UI Elements */
.app-header {
    max-width: 1200px; margin: 0 auto 20px auto;
    display: flex; flex-direction: column; gap: 15px;
}
@media(min-width: 600px) {
    .app-header { flex-direction: row; justify-content: space-between; align-items: center; }
}
#searchBar {
    padding: 10px 16px; width: 100%; max-width: 400px;
    background-color: #1e293b; border: 1px solid #334155;
    border-radius: 6px; color: #f8fafc; font-size: 1rem; outline: none;
}
#searchBar:focus { border-color: #38bdf8; }

/* Pagination Layout Component Styles */
.pagination-controls {
    display: flex; justify-content: center; align-items: center;
    gap: 6px; max-width: 1200px; margin: 20px auto; flex-wrap: wrap;
}
.page-btn {
    background-color: #1e293b; color: #cbd5e1; border: 1px solid #334155;
    padding: 8px 14px; border-radius: 4px; cursor: pointer; font-weight: 600; transition: all 0.2s;
}
.page-btn:hover:not(:disabled) { background-color: #334155; color: #f8fafc; }
.page-btn.active { background-color: #38bdf8; color: #0f172a; border-color: #38bdf8; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.page-dots { color: #64748b; padding: 0 4px; }

/* Grid optimized for 60 elements per view context layout */
.gallery-container {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px; max-width: 1200px; margin: 0 auto; min-height: 400px;
}

.loading-state, .error-state {
    grid-column: 1 / -1; text-align: center; padding: 60px 0;
    font-size: 1.2rem; color: #94a3b8;
}

/* Individual Comic Cards */
.comic-card {
    background-color: #1e293b; padding: 10px; border-radius: 8px;
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); display: flex; flex-direction: column;
}
.comic-card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.5); }
.comic-card img { width: 100%; height: 220px; object-fit: cover; border-radius: 4px; margin-bottom: 8px; background-color: #0f172a; }
.card-series { font-size: 0.7rem; text-transform: uppercase; color: #38bdf8; font-weight: bold; margin-bottom: 4px;}
.comic-card h3 { font-size: 0.9rem; line-height: 1.3; color: #f8fafc; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Modal Infrastructure Base Structuring */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(15, 23, 42, 0.85); backdrop-filter: blur(8px);
    z-index: 1000; justify-content: center; align-items: center; padding: 20px;
    opacity: 0; transition: opacity 0.2s ease-in-out;
}
.modal-overlay.active { display: flex; opacity: 1; }
.modal-content-container {
    position: relative; display: grid; grid-template-columns: 1fr; gap: 30px;
    max-width: 850px; width: 100%; max-height: 90vh; overflow-y: auto;
    background-color: #1e293b; padding: 40px 30px 30px 30px; border-radius: 12px;
    transform: scale(0.95); transition: transform 0.2s ease-in-out;
}
.modal-overlay.active .modal-content-container { transform: scale(1); }

@media (min-width: 768px) {
    .modal-content-container { grid-template-columns: 4fr 6fr; overflow-y: visible; }
}

.close-modal-btn { position: absolute; top: 12px; right: 20px; background: none; border: none; color: #94a3b8; font-size: 2rem; cursor: pointer; }
.close-modal-btn:hover { color: #f8fafc; }

.comic-cover-wrapper { display: flex; justify-content: center; }
.comic-cover { width: 100%; max-width: 320px; height: auto; border-radius: 8px; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6); object-fit: cover; }
.comic-info-wrapper { display: flex; flex-direction: column; gap: 20px; }
.comic-series { text-transform: uppercase; font-size: 0.85rem; font-weight: 700; color: #38bdf8; letter-spacing: 1px; }
.comic-title { font-size: 1.8rem; font-weight: 800; line-height: 1.2; }
.comic-metadata { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; background-color: #0f172a; padding: 12px; border-radius: 8px; font-size: 0.85rem; }
.meta-item strong { color: #94a3b8; display: block; font-size: 0.75rem; text-transform: uppercase; }
h2 { font-size: 1rem; color: #94a3b8; margin-bottom: 6px; text-transform: uppercase; }
.comic-synopsis p { line-height: 1.5; color: #cbd5e1; font-size: 0.95rem; }
.character-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.character-tags li { background-color: #334155; padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; }
.comic-actions { display: flex; gap: 16px; margin-top: auto; padding-top: 15px; }
.btn {display: flex; justify-content: center; align-items: center; text-decoration: none; /* Removes link underline */ padding: 12px 20px; border: none; border-radius: 6px; font-weight: 700; cursor: pointer; flex: 1;}
.btn-primary { background-color: #e11d48; color: white; }
.btn-primary:hover { background-color: #be123c; }
.btn-secondary { background-color: #334155; color: white; }
.btn-secondary:hover { background-color: #475569; }
/* Share Button Styling */
.btn-share {
    background-color: #0ea5e9; /* Modern Sky Blue color */
    color: #ffffff;
}

.btn-share:hover {
    background-color: #0284c7;
}

/* Ensure the shared text transition registers smoothly */
#modalShareBtn {
    transition: background-color 0.2s, transform 0.1s active;
}
/* Sub-header alignment */
.comic-sub-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

/* View count styling with icon alignment */
.comic-views-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: #94a3b8; /* Cool gray color */
    font-weight: 600;
    background-color: #0f172a;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Eye Icon sizing */
.comic-views-badge svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}
