/* Single Magazine Block & Page */
.satmag-single-magazine-block,
.satmag-single-magazine-page {
    margin: 0 auto;
    max-width: 100%;
}

/* Single Magazine Page Template */
.satmag-single-magazine-page {
    max-width: 500px;
    text-align: center;
}

.satmag-single-magazine-page .satmag-magazine-date {
    margin: 15px 0;
    color: #666;
    font-size: 1em;
}

.satmag-single-magazine-page .satmag-single-cover-wrapper {
    margin-bottom: 0;
}

.satmag-single-magazine-page .satmag-magazine-actions {
    margin-top: 20px;
}

.satmag-magazine-header {
    margin-top: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.satmag-magazine-header .satmag-magazine-title {
    margin: 0 0 10px 0;
    font-size: 2em;
    line-height: 1.2;
}

.satmag-magazine-header .satmag-magazine-date {
    margin: 0;
    color: #666;
    font-size: 1em;
}

/* Single Cover Wrapper */
.satmag-single-cover-wrapper {
    width: 100%;
    margin-bottom: 0;
}

.satmag-single-cover {
    position: relative;
    width: 100%;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.satmag-single-cover:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.satmag-single-cover .satmag-cover-image {
    display: block;
    width: 100%;
    height: auto;
}

.satmag-single-cover .satmag-cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.satmag-single-cover:hover .satmag-cover-overlay {
    opacity: 1;
}

.satmag-single-cover .satmag-view-icon {
    font-size: 64px;
    width: 64px;
    height: 64px;
    color: #fff;
    margin-bottom: 10px;
}

.satmag-single-cover .satmag-view-text {
    color: #fff;
    font-size: 1.2em;
    font-weight: 500;
}

.satmag-flipbook-wrapper {
    width: 100%;
    margin-bottom: 20px;
}

.satmag-flipbook-container {
    width: 100%;
    height: 100%;
}

.satmag-magazine-actions {
    text-align: center;
    padding: 15px 0;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.satmag-read-btn,
.satmag-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 1em;
    max-height: 42px;
}

.satmag-read-btn:hover,
.satmag-download-btn:hover {
    background: #005a87;
    color: #fff;
    text-decoration: none;
}

.satmag-read-btn .dashicons,
.satmag-download-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Magazine Archive Block */
.satmag-magazine-archive-block {
    margin: 0 auto;
    max-width: 100%;
}

/* Archive Toolbar */
.satmag-archive-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
    flex-wrap: wrap;
}

/* Layout Toggle */
.satmag-layout-toggle {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.satmag-layout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

.satmag-layout-btn:hover {
    background: #e8e8e8;
    border-color: #ccc;
    color: #333;
}

.satmag-layout-btn.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.satmag-layout-btn.active:hover {
    background: #005a87;
    border-color: #005a87;
}

.satmag-layout-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Year Filter Bar */
.satmag-year-filter {
    flex: 1;
    min-width: 0;
}

.satmag-year-filter-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
}

.satmag-year-btn {
    padding: 10px 20px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    color: #333;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

.satmag-year-btn:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.satmag-year-btn.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.satmag-year-btn.active:hover {
    background: #005a87;
    border-color: #005a87;
}

/* Year groups */
.satmag-year-group {
    margin-bottom: 40px;
}

.satmag-year-group:last-child {
    margin-bottom: 0;
}

.satmag-year-section {
    margin-bottom: 40px;
}

.satmag-year-section:last-child {
    margin-bottom: 0;
}

.satmag-year-header {
    font-size: 1.75em;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 3px solid #0073aa;
    color: #1e1e1e;
}

/* List Layout */
.satmag-magazine-list-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.satmag-archive-list-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.satmag-archive-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.satmag-archive-list-thumb {
    flex-shrink: 0;
    width: 120px;
}

.satmag-archive-list-thumb img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.satmag-archive-list-thumb img:hover {
    transform: scale(1.03);
}

.satmag-archive-list-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.satmag-archive-list-title {
    margin: 0 0 8px 0;
    font-size: 1.25em;
    font-weight: 600;
    line-height: 1.3;
}

.satmag-archive-list-title a {
    color: #1e1e1e;
    text-decoration: none;
}

.satmag-archive-list-title a:hover {
    color: #0073aa;
}

.satmag-archive-list-date {
    margin: 0 0 12px 0;
    color: #666;
    font-size: 0.9em;
}

.satmag-archive-list-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.satmag-archive-action-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f5f5f5;
    border-radius: 6px;
    color: #333;
    font-size: 0.9em;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.satmag-archive-action-link:hover {
    background: #0073aa;
    color: #fff;
}

.satmag-archive-action-link .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

@media (max-width: 768px) {
    .satmag-archive-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .satmag-layout-toggle {
        justify-content: flex-end;
    }
}

@media (max-width: 600px) {
    .satmag-archive-list-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .satmag-archive-list-thumb {
        width: 150px;
    }

    .satmag-archive-list-actions {
        justify-content: center;
    }

    .satmag-year-filter-inner {
        justify-content: center;
    }

    .satmag-layout-toggle {
        justify-content: center;
    }
}

.satmag-magazine-grid {
    display: grid;
    grid-template-columns: repeat(var(--satmag-columns, 4), 1fr);
    gap: 25px;
}

@media (max-width: 992px) {
    .satmag-magazine-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .satmag-magazine-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .satmag-magazine-grid {
        grid-template-columns: 1fr;
        max-width: 300px;
        margin: 0 auto;
    }
}

.satmag-magazine-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.satmag-magazine-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.satmag-magazine-cover {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
}

.satmag-cover-clickable {
    cursor: pointer;
    position: relative;
    width: 100%;
    height: 100%;
}

.satmag-cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.satmag-magazine-card:hover .satmag-cover-image {
    transform: scale(1.05);
}

.satmag-cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.satmag-magazine-cover:hover .satmag-cover-overlay,
.satmag-cover-clickable:hover .satmag-cover-overlay {
    opacity: 1;
}

.satmag-view-icon {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #fff;
}

.satmag-magazine-info {
    padding: 15px;
}

.satmag-magazine-info .satmag-magazine-title {
    margin: 0 0 8px 0;
    font-size: 1em;
    line-height: 1.4;
}

.satmag-magazine-info .satmag-magazine-title a {
    color: #1e1e1e;
    text-decoration: none;
}

.satmag-magazine-info .satmag-magazine-title a:hover {
    color: #0073aa;
}

.satmag-magazine-info .satmag-magazine-date {
    margin: 0;
    color: #666;
    font-size: 0.9em;
}

.satmag-magazine-card .satmag-magazine-actions {
    display: flex;
    gap: 8px;
    padding: 10px 15px 15px;
    justify-content: flex-start;
}

.satmag-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 42px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    text-decoration: none;
}

.satmag-action-btn:hover {
    background: #0073aa;
    color: #fff;
}

.satmag-action-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Modal Styles */
.satmag-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.satmag-modal.is-open {
    display: block;
}

.satmag-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.satmag-modal-content {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    background: transparent;
    display: flex;
    flex-direction: column;
}

.satmag-modal-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    border-radius: 0 0 0 8px;
}

.satmag-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.satmag-modal-close .dashicons {
    font-size: 30px;
    width: 30px;
    height: 30px;
}

.satmag-modal-flipbook {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.satmag-modal-flipbook .satmag-flipbook-instance {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
}

/* Error States */
.satmag-no-magazine,
.satmag-no-pdf,
.satmag-no-magazines {
    padding: 40px;
    text-align: center;
    background: #f9f9f9;
    border-radius: 8px;
    color: #666;
}

.satmag-flipbook-error {
    padding: 20px;
    text-align: center;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
}

/* Hide old lightbox trigger */
.satmag-flipbook-lightbox-trigger {
    display: none;
}

/* Body scroll lock when modal is open */
body.satmag-modal-open {
    overflow: hidden;
}

/* Flipbook skin colors */
.skin-color-bg {
    background: #1f1f1f;
}

.flipbook-bookLayer {
    background: #000;
}

/* Flipbook tooltip styles - position above buttons, white text */
.flipbook-menuTop .flipbook-has-tooltip::before {
    top: auto !important;
    bottom: calc(100% + 8px) !important;
    color: #fff !important;
    background-color: rgba(0, 0, 0, 0.9) !important;
}

.flipbook-tooltip-element {
    color: #fff !important;
    background-color: rgba(0, 0, 0, 0.9) !important;
}

/* ==========================================================================
   Magazine List Block
   ========================================================================== */

.satmag-magazine-list-block {
    margin: 0 auto;
}

.satmag-magazine-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.satmag-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #e5e5e5;
}

.satmag-list-item:last-child {
    border-bottom: none;
}

.satmag-list-thumb {
    flex-shrink: 0;
}

.satmag-list-thumb a {
    display: block;
}

.satmag-list-thumb-img {
    display: block;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.2s ease;
}

.satmag-list-thumb a:hover .satmag-list-thumb-img {
    transform: scale(1.05);
}

.satmag-list-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border-radius: 4px;
    color: #999;
    text-decoration: none;
}

.satmag-list-thumb-placeholder:hover {
    background: #e5e5e5;
}

.satmag-list-thumb-placeholder .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

/* Thumbnail sizes */
.satmag-thumb-small .satmag-list-thumb-img,
.satmag-thumb-small .satmag-list-thumb-placeholder {
    width: 50px;
    height: 65px;
}

.satmag-thumb-medium .satmag-list-thumb-img,
.satmag-thumb-medium .satmag-list-thumb-placeholder {
    width: 80px;
    height: 105px;
}

.satmag-thumb-large .satmag-list-thumb-img,
.satmag-thumb-large .satmag-list-thumb-placeholder {
    width: 120px;
    height: 156px;
}

.satmag-list-content {
    flex: 1;
    min-width: 0;
}

.satmag-list-title {
    margin: 0 0 4px 0;
    font-size: 0.95em;
    font-weight: 600;
    line-height: 1.4;
}

.satmag-list-title a {
    color: #1e1e1e;
    text-decoration: none;
}

.satmag-list-title a:hover {
    color: #0073aa;
}

.satmag-list-date {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-bottom: 4px;
}

.satmag-list-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 6px;
}

.satmag-list-view-link,
.satmag-list-download-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85em;
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.satmag-list-view-link:hover,
.satmag-list-download-link:hover {
    color: #005a87;
    text-decoration: underline;
}

.satmag-list-view-link .dashicons,
.satmag-list-download-link .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Clickable thumbnail */
.satmag-list-thumb-clickable {
    cursor: pointer;
    display: block;
}

.satmag-list-thumb-clickable:hover .satmag-list-thumb-img {
    transform: scale(1.05);
}

/* View All link */
.satmag-view-all-wrapper {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e5e5;
    text-align: right;
}

.satmag-view-all-link {
    display: inline-block;
    font-size: 0.9em;
    color: #0073aa;
    text-decoration: none;
    font-weight: 600;
}

.satmag-view-all-link:hover {
    color: #005a87;
    text-decoration: underline;
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

/* Date colors */
.dark-mode .satmag-magazine-header .satmag-magazine-date,
.dark-mode .satmag-magazine-info .satmag-magazine-date {
    color: #b0b0b0;
}

/* Year header */
.dark-mode .satmag-year-header {
    color: #e0e0e0;
    border-bottom-color: #ff7777;
}

/* Magazine cards */
.dark-mode .satmag-magazine-card {
    background: #2a2a2a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark-mode .satmag-magazine-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Single cover */
.dark-mode .satmag-single-cover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.dark-mode .satmag-single-cover:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* Magazine titles */
.dark-mode .satmag-magazine-info .satmag-magazine-title a {
    color: #e0e0e0;
}

.dark-mode .satmag-magazine-info .satmag-magazine-title a:hover {
    color: #ff7777;
}

/* Action buttons */
.dark-mode .satmag-action-btn {
    background: #3a3a3a;
    color: #e0e0e0;
}

.dark-mode .satmag-action-btn:hover {
    background: #ff7777;
    color: #1a1a1a;
}

/* Primary buttons */
.dark-mode .satmag-read-btn,
.dark-mode .satmag-download-btn {
    background: #ff7777;
    color: #1a1a1a;
}

.dark-mode .satmag-read-btn:hover,
.dark-mode .satmag-download-btn:hover {
    background: #ff5555;
    color: #1a1a1a;
}

/* Error/empty states */
.dark-mode .satmag-no-magazine,
.dark-mode .satmag-no-pdf,
.dark-mode .satmag-no-magazines {
    background: #2a2a2a;
    color: #b0b0b0;
}

.dark-mode .satmag-flipbook-error {
    background: #3a3020;
    border-color: #5a4a30;
    color: #e0c080;
}

/* Modal backdrop - slightly lighter in dark mode for contrast */
.dark-mode .satmag-modal-backdrop {
    background: rgba(0, 0, 0, 0.95);
}

/* Modal close button */
.dark-mode .satmag-modal-close {
    background: rgba(255, 255, 255, 0.05);
}

.dark-mode .satmag-modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Magazine List dark mode */
.dark-mode .satmag-list-item {
    border-bottom-color: #3a3a3a;
}

.dark-mode .satmag-list-title a {
    color: #e0e0e0;
}

.dark-mode .satmag-list-title a:hover {
    color: #ff7777;
}

.dark-mode .satmag-list-date {
    color: #b0b0b0;
}

.dark-mode .satmag-list-view-link,
.dark-mode .satmag-list-download-link {
    color: #ff7777;
}

.dark-mode .satmag-list-view-link:hover,
.dark-mode .satmag-list-download-link:hover {
    color: #ff5555;
}

.dark-mode .satmag-list-thumb-placeholder {
    background: #3a3a3a;
    color: #888;
}

.dark-mode .satmag-list-thumb-placeholder:hover {
    background: #4a4a4a;
}

.dark-mode .satmag-view-all-wrapper {
    border-top-color: #3a3a3a;
}

.dark-mode .satmag-view-all-link {
    color: #ff7777;
}

.dark-mode .satmag-view-all-link:hover {
    color: #ff5555;
}

/* Archive Toolbar dark mode */
.dark-mode .satmag-archive-toolbar {
    border-bottom-color: #3a3a3a;
}

/* Layout Toggle dark mode */
.dark-mode .satmag-layout-btn {
    background: #2a2a2a;
    border-color: #3a3a3a;
    color: #b0b0b0;
}

.dark-mode .satmag-layout-btn:hover {
    background: #3a3a3a;
    border-color: #4a4a4a;
    color: #e0e0e0;
}

.dark-mode .satmag-layout-btn.active {
    background: #ff7777;
    border-color: #ff7777;
    color: #1a1a1a;
}

.dark-mode .satmag-layout-btn.active:hover {
    background: #ff5555;
    border-color: #ff5555;
}

/* Year Filter dark mode */
.dark-mode .satmag-year-filter-inner {
    border-bottom-color: #3a3a3a;
}

.dark-mode .satmag-year-btn {
    background: #2a2a2a;
    border-color: #3a3a3a;
    color: #e0e0e0;
}

.dark-mode .satmag-year-btn:hover {
    background: #3a3a3a;
    border-color: #4a4a4a;
}

.dark-mode .satmag-year-btn.active {
    background: #ff7777;
    border-color: #ff7777;
    color: #1a1a1a;
}

.dark-mode .satmag-year-btn.active:hover {
    background: #ff5555;
    border-color: #ff5555;
}

/* List Layout dark mode */
.dark-mode .satmag-archive-list-item {
    background: #2a2a2a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark-mode .satmag-archive-list-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.dark-mode .satmag-archive-list-title a {
    color: #e0e0e0;
}

.dark-mode .satmag-archive-list-title a:hover {
    color: #ff7777;
}

.dark-mode .satmag-archive-list-date {
    color: #b0b0b0;
}

.dark-mode .satmag-archive-action-link {
    background: #3a3a3a;
    color: #e0e0e0;
}

.dark-mode .satmag-archive-action-link:hover {
    background: #ff7777;
    color: #1a1a1a;
}
