/* ==========================================================================
   Magazine Subscriptions & Circulation Suite - Public Stylesheet
   ========================================================================== */

:root {
    --mag-primary: #0a192f;
    --mag-accent: #2563eb;
    --mag-gold: #d4af37;
    --mag-bg-light: #f8fafc;
    --mag-text: #0f172a;
    --mag-text-muted: #64748b;
    --mag-border: #e2e8f0;
    --mag-radius: 12px;
}

/* -------------------------------------------------------------
 * 1. Homepage 3D Interactive Hero Showcase
 * ------------------------------------------------------------- */
.mag-hero-section {
    background: linear-gradient(135deg, #0a192f 0%, #1e293b 100%);
    color: #ffffff;
    padding: 60px 20px;
    border-radius: var(--mag-radius);
    margin: 30px auto;
    max-width: 1200px;
    box-shadow: 0 20px 40px rgba(10, 25, 47, 0.2);
}

.mag-hero-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    max-width: 1100px;
    margin: 0 auto;
}

.mag-hero-content {
    flex: 1;
}

.mag-badge-pill {
    display: inline-block;
    background: rgba(212, 175, 55, 0.15);
    color: #d4af37;
    border: 1px solid rgba(212, 175, 55, 0.4);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 16px;
}

.mag-hero-title {
    font-size: 38px;
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 15px;
    color: #ffffff;
}

.mag-hero-tagline {
    font-size: 18px;
    color: #94a3b8;
    margin-bottom: 24px;
    line-height: 1.5;
}

.mag-hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.mag-btn-read-3d {
    background: #ffffff;
    color: #0a192f;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
}

.mag-btn-read-3d:hover {
    background: #d4af37;
    color: #0a192f;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(212, 175, 55, 0.3);
}

.mag-btn-archive-link {
    background: transparent;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s ease;
}

.mag-btn-archive-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
}

/* 3D Magazine Cover Perspective & Realistic Depth */
.mag-hero-cover {
    flex: 0 0 320px;
    perspective: 1500px;
}

.mag-book-3d {
    position: relative;
    width: 270px;
    height: 380px;
    transform: rotateY(-24deg) rotateX(8deg);
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.6s ease;
    box-shadow: 25px 25px 50px rgba(0, 0, 0, 0.55), 0 0 20px rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.mag-book-3d:hover {
    transform: rotateY(-6deg) rotateX(2deg) scale(1.05);
    box-shadow: 30px 30px 60px rgba(0, 0, 0, 0.65), 0 0 30px rgba(212, 175, 55, 0.2);
}

.mag-book-front {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 4px;
    overflow: hidden;
    background: #0f172a;
}

.mag-book-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.mag-book-spine {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 100%;
    background: linear-gradient(90deg, #050b14 0%, #1e293b 50%, #050b14 100%);
    transform: rotateY(90deg) translateZ(-12px);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.8);
}

.mag-book-shine {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.05) 40%, rgba(0, 0, 0, 0.25) 100%);
    pointer-events: none;
}

/* Fallback Editorial Magazine Cover */
.mag-cover-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #0a192f 0%, #172554 50%, #030712 100%);
    border: 3px solid rgba(212, 175, 55, 0.6);
    box-sizing: border-box;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
    color: #ffffff;
}

.mag-fallback-brand {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #d4af37;
    text-transform: uppercase;
}

.mag-fallback-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    color: #ffffff;
    margin: auto 0;
}

.mag-fallback-date {
    font-size: 12px;
    letter-spacing: 1.5px;
    color: #94a3b8;
    text-transform: uppercase;
}

/* Hero Content Details */
.mag-hero-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.mag-meta-date-pill {
    background: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.mag-meta-vol-pill {
    background: rgba(212, 175, 55, 0.18);
    color: #fde047;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.mag-hero-story-callout {
    background: rgba(255, 255, 255, 0.06);
    border-left: 3px solid #d4af37;
    padding: 14px 18px;
    border-radius: 0 8px 8px 0;
    margin: 18px 0;
}

.mag-story-label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #d4af37;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.mag-hero-story-text {
    margin: 0;
    font-size: 16px;
    font-style: italic;
    color: #f1f5f9;
    line-height: 1.5;
}

.mag-hero-highlights {
    margin: 18px 0 24px;
}

.mag-highlights-label {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    display: block;
}

.mag-highlights-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mag-highlight-tag {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
}

/* Recent Strip */
.mag-recent-strip {
    margin-top: 50px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 30px;
}

.mag-recent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.mag-recent-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}

.mag-link-all {
    color: #d4af37;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: color 0.2s;
}

.mag-link-all:hover {
    color: #ffffff;
}

.mag-recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.mag-recent-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    text-decoration: none;
    display: flex;
    gap: 12px;
    align-items: center;
    transition: all 0.25s ease;
}

.mag-recent-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.mag-recent-thumb {
    width: 60px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
}

.mag-recent-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mag-recent-info {
    flex: 1;
    overflow: hidden;
}

.mag-recent-date {
    display: block;
    font-size: 11px;
    color: #d4af37;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.mag-recent-name {
    margin: 0;
    font-size: 13px;
    color: #ffffff;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* -------------------------------------------------------------
 * 2. Multi-Faceted Archive Section & Filter Bar
 * ------------------------------------------------------------- */
.mag-archive-wrap {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.mag-filter-bar {
    background: #ffffff;
    padding: 20px;
    border-radius: var(--mag-radius);
    border: 1px solid var(--mag-border);
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    margin-bottom: 35px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.mag-filter-input,
.mag-filter-select {
    padding: 10px 16px;
    border: 1px solid var(--mag-border);
    border-radius: 8px;
    font-size: 14px;
    background: #ffffff;
    color: var(--mag-text);
    outline: none;
    transition: border 0.2s ease;
}

.mag-filter-input:focus,
.mag-filter-select:focus {
    border-color: var(--mag-primary);
}

.mag-filter-search {
    flex: 1;
    min-width: 200px;
}

/* =============================================================
 * 2. Homepage Latest Issues Section (IMG 2) & Magazine Cards (IMG 1)
 * ============================================================= */

/* Homepage Section Wrapper (IMG 2) */
.mag-latest-section {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Header with Title and "See All Previous Issue" button */
.mag-latest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 2px solid #f0f0f0;
}

.mag-latest-title {
    font-size: 26px;
    font-weight: 800;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    line-height: 1.2;
}

.mag-btn-see-previous {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #e60000;
    color: #ffffff !important;
    padding: 10px 22px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(230, 0, 0, 0.25);
}

.mag-btn-see-previous:hover {
    background-color: #c00000;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(230, 0, 0, 0.35);
}

/* 4-Column Responsive Grid */
.mag-latest-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* -------------------------------------------------------------
 * EXACT MAGAZINE CARD DESIGN (MATCHING IMG 1)
 * - Thin crisp red border (1px solid #e60000)
 * - White background
 * - Full-bleed cover image on top
 * - ZERO badges (no unlocked or free sample pills!)
 * - Centered uppercase bold red title (#e60000)
 * - Centered uppercase muted gray subtitle (#777777)
 * ------------------------------------------------------------- */
.mag-edition-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    background: #ffffff;
    border: 1px solid #e60000;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.mag-edition-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(230, 0, 0, 0.16);
}

/* Cover Image Container */
.mag-card-cover-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1.36;
    background: #f8fafc;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mag-card-cover-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.mag-edition-card:hover .mag-card-cover-wrap img {
    transform: scale(1.025);
}

/* NO BADGES EVER: Strictly hide any badge pills on cards */
.mag-edition-card .mag-sample-badge,
.mag-edition-card .mag-badge,
.mag-edition-card .mag-badge-pill,
.mag-edition-card .mag-badge-top {
    display: none !important;
}

/* Card Body */
.mag-card-body {
    padding: 14px 12px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #ffffff;
    flex-grow: 1;
}

/* Card Title (Bold Red Uppercase) */
.mag-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #e60000 !important;
    text-transform: uppercase;
    margin: 0 0 6px 0;
    line-height: 1.35;
    letter-spacing: 0.3px;
}

/* Card Meta (Muted Gray Uppercase) */
.mag-card-meta {
    font-size: 11px;
    font-weight: 600;
    color: #777777;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0;
    line-height: 1.3;
}

/* Editorial Fallback Placeholder when cover is missing */
.mag-cover-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    border-bottom: 2px solid #e60000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 24px 16px;
    box-sizing: border-box;
    text-align: center;
}

.mag-placeholder-brand {
    font-size: 13px;
    font-weight: 800;
    color: #e60000;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.mag-placeholder-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.35;
    margin: auto 0;
}

.mag-placeholder-date {
    font-size: 11px;
    color: #9ca3af;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* -------------------------------------------------------------
 * 3. Dynamic Subscription Pricing Table
 * ------------------------------------------------------------- */
.mag-pricing-wrapper {
    max-width: 1100px;
    margin: 50px auto;
    padding: 0 20px;
}

.mag-renewal-banner {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
    padding: 16px 20px;
    border-radius: 6px;
    margin-bottom: 30px;
    color: #1e3a8a;
    font-size: 14px;
    line-height: 1.5;
}

.mag-pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    align-items: stretch;
}

.mag-plan-card {
    background: #ffffff;
    border: 1px solid var(--mag-border);
    border-radius: var(--mag-radius);
    padding: 35px 30px;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.mag-plan-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.mag-plan-featured {
    border: 2px solid var(--mag-primary);
    box-shadow: 0 10px 30px rgba(10, 25, 47, 0.12);
}

.mag-plan-badge-top {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--mag-primary);
    color: #ffffff;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mag-plan-name {
    font-size: 22px;
    font-weight: 800;
    color: var(--mag-text);
    margin: 10px 0 8px;
}

.mag-plan-desc {
    color: var(--mag-text-muted);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 24px;
    min-height: 42px;
}

.mag-plan-pricing {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 12px;
}

.mag-original-price {
    text-decoration: line-through;
    color: #94a3b8;
    font-size: 18px;
    margin-right: 6px;
}

.mag-currency {
    font-size: 24px;
    font-weight: 700;
    color: var(--mag-text);
}

.mag-amount {
    font-size: 42px;
    font-weight: 800;
    color: var(--mag-text);
}

.mag-term {
    color: var(--mag-text-muted);
    font-size: 14px;
    margin-left: 4px;
}

.mag-discount-pill {
    display: inline-block;
    background: #dcfce7;
    color: #15803d;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 20px;
}

.mag-plan-perks {
    list-style: none;
    padding: 0;
    margin: 0 0 30px;
    flex: 1;
}

.mag-plan-perks li {
    font-size: 14px;
    color: #475569;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mag-check {
    color: #10b981;
    font-weight: 800;
}

.mag-trigger-checkout {
    width: 100%;
    padding: 15px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.25s ease;
}

.mag-btn-primary {
    background: #f1f5f9;
    color: var(--mag-text);
}

.mag-btn-primary:hover {
    background: #e2e8f0;
}

.mag-btn-accent {
    background: var(--mag-primary);
    color: #ffffff;
}

.mag-btn-accent:hover {
    background: #1e293b;
}

/* -------------------------------------------------------------
 * 4. Unified Subscriber Command Center & Profile Portal
 * ------------------------------------------------------------- */
.mag-portal-wrapper {
    max-width: 1050px;
    margin: 40px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.mag-portal-header {
    background: #ffffff;
    border: 1px solid var(--mag-border);
    border-radius: var(--mag-radius);
    padding: 24px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    flex-wrap: wrap;
    gap: 20px;
}

.mag-portal-user-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mag-portal-avatar-circle {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #0a192f;
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(10, 25, 47, 0.2);
}

.mag-portal-greeting {
    margin: 0 0 4px 0;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
}

.mag-portal-email {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.mag-portal-plan-badge {
    text-align: right;
}

.mag-plan-tag {
    display: inline-block;
    background: #eff6ff;
    color: #1e40af;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-right: 6px;
}

.mag-status-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.mag-status-tag.status-active,
.mag-status-badge.mag-status-active {
    background: #dcfce7;
    color: #15803d;
}

.mag-status-tag.status-expired {
    background: #fee2e2;
    color: #b91c1c;
}

.mag-status-tag.status-pending {
    background: #fef3c7;
    color: #b45309;
}

.mag-status-tag.status-vip {
    background: #fef08a;
    color: #854d0e;
}

.mag-validity-text {
    margin-top: 6px;
    font-size: 12px;
    color: #64748b;
}

/* Tab Navigation */
.mag-portal-tab-nav {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.mag-tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    border-radius: 6px 6px 0 0;
}

.mag-tab-btn:hover {
    color: #0f172a;
    background: #f8fafc;
}

.mag-tab-btn.active {
    color: #e60000;
    border-bottom-color: #e60000;
    font-weight: 700;
    background: #fff5f5;
}

.mag-tab-logout {
    margin-left: auto;
    color: #ef4444;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    padding: 12px 16px;
    display: inline-flex;
    align-items: center;
}

.mag-tab-logout:hover {
    text-decoration: underline;
}

/* Tab Contents */
.mag-tab-content {
    display: none;
}

.mag-tab-content.active {
    display: block;
}

.mag-portal-card {
    background: #ffffff;
    border: 1px solid var(--mag-border);
    border-radius: var(--mag-radius);
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

.mag-card-header-line {
    margin-bottom: 24px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 14px;
}

.mag-card-header-line h3 {
    margin: 0 0 6px 0;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.mag-subtitle-note {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

.mag-portal-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.mag-form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.mag-form-row-3col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* EMAIL LOCKED STYLES (Read-Only Security) */
.mag-input-locked {
    background: #f1f5f9 !important;
    color: #64748b !important;
    cursor: not-allowed !important;
    border: 1px solid #cbd5e1 !important;
}

.mag-lock-tag {
    display: inline-block;
    font-size: 11px;
    background: #fee2e2;
    color: #b91c1c;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}

.mag-field-hint {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

.mag-inner-divider {
    border: 0;
    height: 1px;
    background: #e2e8f0;
    margin: 15px 0;
}

/* Subscription status card inside Tab 2 */
.mag-subscription-status-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

/* Responsive GST Tax Invoice Table */
.mag-table-responsive {
    overflow-x: auto;
}

.mag-portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

.mag-portal-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 12px 14px;
    border-bottom: 2px solid #e2e8f0;
}

.mag-portal-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.mag-pill-gray {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.mag-status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.mag-btn-small {
    display: inline-block;
    background: #0a192f;
    color: #ffffff !important;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease;
}

.mag-btn-small:hover {
    background: #1e293b;
}

.mag-empty-state {
    text-align: center;
    padding: 30px;
    color: #64748b;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
}

/* -------------------------------------------------------------
 * 5. Auth Cards & Forms
 * ------------------------------------------------------------- */
.mag-auth-card {
    max-width: 440px;
    margin: 40px auto;
    padding: 35px 30px;
    background: #ffffff;
    border: 1px solid var(--mag-border);
    border-radius: var(--mag-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.mag-auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mag-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mag-form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.mag-form-group input {
    padding: 12px 14px;
    border: 1px solid var(--mag-border);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border 0.2s ease;
}

.mag-form-group input:focus {
    border-color: var(--mag-primary);
}

.mag-form-row {
    display: flex;
    gap: 12px;
}

.mag-form-row .mag-form-group {
    flex: 1;
}

.mag-form-row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.mag-btn-auth-submit {
    background: var(--mag-primary);
    color: #ffffff;
    padding: 14px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mag-btn-auth-submit:hover {
    background: #1e293b;
}

.mag-auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--mag-text-muted);
}

.mag-notice-error {
    background: #fee2e2;
    color: #b91c1c;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}

.mag-notice-success {
    background: #dcfce7;
    color: #15803d;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* Social Login Divider & Buttons */
.mag-social-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 22px 0 16px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.mag-social-divider::before,
.mag-social-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}

.mag-social-divider span {
    padding: 0 12px;
}

.mag-social-login-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.mag-social-login-actions iframe {
    margin: 0 auto !important;
}

/* -------------------------------------------------------------
 * 6. Responsive Breakpoints
 * ------------------------------------------------------------- */
@media (max-width: 1024px) {
    .mag-latest-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .mag-hero-container {
        flex-direction: column-reverse;
        text-align: center;
    }

    .mag-hero-cover {
        flex: auto;
    }

    .mag-book-3d {
        margin: 0 auto;
        width: 220px;
        height: 300px;
    }

    .mag-hero-actions {
        justify-content: center;
    }

    .mag-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .mag-filter-search,
    .mag-filter-select {
        width: 100%;
    }

    .mag-portal-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .mag-portal-plan-badge {
        text-align: left;
    }

    .mag-form-row-2col,
    .mag-form-row-3col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .mag-latest-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .mag-latest-title {
        font-size: 22px;
    }

    .mag-latest-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .mag-portal-tab-nav {
        flex-direction: column;
        gap: 4px;
    }

    .mag-tab-btn {
        width: 100%;
        text-align: left;
        border-bottom: none;
        border-left: 3px solid transparent;
        border-radius: 4px;
    }

    .mag-tab-btn.active {
        border-left-color: #e60000;
        border-bottom-color: transparent;
    }

    .mag-tab-logout {
        margin-left: 0;
        padding: 10px 12px;
    }
}

/* -------------------------------------------------------------
 * 7. Promo Coupons & Higher Plan Restricted PDF Badges
 * ------------------------------------------------------------- */
.mag-coupon-apply-wrap {
    max-width: 460px;
    margin: 0 auto 30px;
    text-align: center;
}

.mag-coupon-inner {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 4px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    transition: border-color 0.2s ease;
}

.mag-coupon-inner:focus-within {
    border-color: #2563eb;
}

.mag-coupon-icon {
    font-size: 18px;
    padding: 0 8px;
}

#mag-promo-code-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    color: #0f172a;
    background: transparent;
    padding: 8px 4px;
}

#mag-btn-apply-promo {
    background: #0a192f;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

#mag-btn-apply-promo:hover {
    background: #1e293b;
}

#mag-promo-feedback {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    padding: 8px 12px;
}

#mag-promo-feedback.success {
    background: #dcfce7;
    color: #15803d;
}

#mag-promo-feedback.error {
    background: #fee2e2;
    color: #b91c1c;
}

/* Restricted PDF Download Badge in Flipbook Toolbar */
.mag-pdf-restricted-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 20px;
    padding: 4px 12px 4px 10px;
}

.mag-pdf-locked-pill {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

.mag-pdf-upgrade-btn {
    font-size: 11px;
    font-weight: 700;
    color: #ffffff !important;
    background: #e60000;
    padding: 3px 10px;
    border-radius: 12px;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.2s ease;
}

.mag-pdf-upgrade-btn:hover {
    background: #c00000;
}
