/* ========================
   Global Box Sizing
======================== */
*, *::before, *::after {
    box-sizing: border-box;
}

/* ========================
   Header Logo
======================== */
header img.logo {
    max-width: 80px; 
    height: auto;    
    margin-right: 10px;
}

/* ========================
   Body
======================== */
html {
    overflow-x: hidden;
}

body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #FFFFFF;
    color: #333;
    overflow-x: hidden; /* Horizontal scroll fix */
    box-sizing: border-box;
}

/* ========================
   Header
======================== */
header {
    background-color: #1E73BE;
    color: white;
    display: flex;
    align-items: center;
    padding: 15px 10px;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    flex-wrap: wrap;
}

.header-title {
    flex-grow: 1;
    text-align: center;
    font-size: 32px;
    margin: 0;
}

/* ========================
   Footer
======================== */
footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 15px 0;
    width: 100%;
    position: relative;
    bottom: 0;
}

.google-ads-container {
    width: 100%;
    max-width: 100vw; /* viewport width fix */
    margin: 0 auto;
    padding: 0; /* remove padding to prevent overflow */
    overflow: hidden;
    box-sizing: border-box;
}

.google-ads-container iframe {
    width: 100% !important;
    max-width: 100%;
    height: auto;
    border: none;
    display: block;
}

img, iframe {
    max-width: 100%;
}

/* ========================
   Main Layout
======================== */
main {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.side-nav {
    width: 20%;
    background: #fff;
    padding: 15px;
    margin: 10px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

.side-nav a {
    word-break: break-word;
    display: block;
    color: #1E73BE;
    text-decoration: none;
    margin: 10px 0;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.3s;
}

.side-nav a:hover {
    background-color: #1E73BE;
    color: white;
}

.content {
    width: 50%;
    max-width: 56%;
    min-width: 300px;
    flex: 1 1 56%;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow-wrap: anywhere;
}

/* ========================
   Headings & Table
======================== */
h1, h2 {
    color: #333;
    margin: 0;
}

h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

h2 {
    font-size: 22px;
    margin-top: 20px;
    margin-bottom: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

th, td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

th {
    background-color: #1E73BE;
    color: white;
}

/* ========================
   Responsive Design
======================== */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-title {
        font-size: 24px;
        text-align: center;
        margin-top: 10px;
    }

    main {
        flex-direction: column;
    }

    .side-nav {
        width: 100%;
        margin: 10px 0;
    }

    .content {
        width: 100%;
    }

    table {
        font-size: 14px;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    footer {
        padding: 10px 0;
    }

    .google-ads-container {
        max-width: 100vw;
        padding: 0;
    }
}

@media (max-width: 480px) {
    .side-nav {
        width: 100%;
    }

    .content {
        width: 100%;
        padding: 10px;
    }

    header img.logo {
        max-width: 60px;
    }

    .header-title {
        font-size: 20px;
    }

    .google-ads-container {
        max-width: 100vw;
        padding: 0;
    }
}

/* ========================
   RESPONSIVE AD CONTAINERS
======================== */

/* Base ad container - RESPONSIVE */
.ad-responsive-container {
    width: 100%;
    max-width: 100%;
    margin: 20px auto;
    padding: 10px;
    text-align: center;
    overflow: hidden;
    display: block !important;
    position: relative;
    min-height: 100px; /* Prevent collapse */
}

/* Ensure ads are visible */
.ad-responsive-container ins {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    min-height: 100px; /* Minimum height */
}

/* Sidebar ads specific */
.side-nav .ad-responsive-container {
    margin: 25px auto;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1px;
}

/* Content ads specific */
.content .ad-responsive-container.content-ad {
    margin: 30px 0;
    background: #f0f7ff;
    border: 2px solid #4CAF50;
    border-radius: 10px;
    padding: 20px;
}

/* ========================
   MOBILE SPECIFIC AD STYLES
======================== */
@media (max-width: 768px) {
    /* Mobile ads - full width */
    .ad-responsive-container {
        margin: 15px auto;
        padding: 8px;
        min-height: 90px;
    }
    
    /* Mobile sidebar ads */
    .side-nav .ad-responsive-container {
        margin: 20px auto;
        padding: 12px;
    }
    
    /* Mobile content ads */
    .content .ad-responsive-container.content-ad {
        margin: 25px 0;
        padding: 15px;
    }
    
    /* Ensure ads don't overflow on mobile */
    .ad-responsive-container ins {
        min-height: 90px;
        overflow: hidden;
    }
}

@media (max-width: 480px) {
    /* Small mobile adjustments */
    .ad-responsive-container {
        margin: 10px auto;
        padding: 5px;
        min-height: 80px;
    }
    
    .side-nav .ad-responsive-container {
        margin: 15px auto;
        padding: 0px;
    }
    
    .content .ad-responsive-container.content-ad {
        margin: 20px 0;
        padding: 12px;
    }
    
    .ad-responsive-container ins {
        min-height: 80px;
    }
}

/* ========================
   AD VISIBILITY FIXES
======================== */

/* Prevent ad containers from collapsing */
.ad-responsive-container:empty {
    display: none !important;
}

/* Loading state for ads */
.ad-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    min-height: 100px;
    border-radius: 8px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Ad placeholder for slow loading */
.ad-placeholder {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: 2px dashed #ddd;
    border-radius: 8px;
    color: #666;
    font-size: 14px;
}

/* ========================
   New Layout (Sidebar Toggle)
======================== */
.layout {
    display: block;
    width: 100%;
}

.sidebar-toggle {
    appearance: none;
    border: 0;
    position: sticky;
    top: 10px;
    z-index: 1001;
    margin: 10px;
    padding: 10px 14px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 280px;
    background: #fff;
    padding: 16px;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    z-index: 1000;
}

body.sidebar-open .sidebar {
    transform: translateX(0);
}

/* Keep content clean and centered */
.content {
    max-width: 900px;
    width: 100%;
    margin: 10px auto 40px auto;
}

/* Hide legacy side-nav in main layout to avoid duplicates */
main > .side-nav {
    display: none;
}

@media (min-width: 992px) {
    .sidebar-toggle {
    appearance: none;
    border: 0;
        position: fixed;
        left: 10px;
        top: 10px;
    }
}


/* Top Bar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    position: sticky;
    top: 0;
    background: #1E73BE;
    z-index: 1002;
}

.topbar-title {
    flex: 1;
    text-align: center;
    font-weight: 700;
    color: #fff;
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar {
    position: fixed;
    top: 0;
    height: 100vh;
    width: 280px;
    background: #fff;
    padding: 16px;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-right {
    right: 0;
    left: auto;
    transform: translateX(100%);
}

body.left-open .sidebar-left {
    transform: translateX(0);
}

body.right-open .sidebar-right {
    transform: translateX(0);
}

@media (min-width: 992px) {
    .topbar-title { font-size: 18px; }
}


/* Strong overrides for desktop menu buttons */
.topbar {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1200;
}
.topbar .sidebar-toggle {
  position: static !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FF6F00;
  color: #fff;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}
body.left-open .sidebar-left {
  transform: translateX(0) !important;
}
body.right-open .sidebar-right {
  transform: translateX(0) !important;
}


/* Sidebar overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 999;
}
body.left-open .sidebar-overlay,
body.right-open .sidebar-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* Ensure sidebars hidden by default */
.sidebar-left { left: 0; transform: translateX(-100%) !important; }
.sidebar-right { right: 0; transform: translateX(100%) !important; }
body.left-open .sidebar-left { transform: translateX(0) !important; }
body.right-open .sidebar-right { transform: translateX(0) !important; }

/* Topbar position below header */
main .topbar {
  position: sticky;
  top: 0;
  z-index: 1200;
  margin-top: 8px;
}




.sidebar a {
  word-break: normal;
  white-space: normal;
  writing-mode: horizontal-tb;
}


/* Sidebar visibility via body classes */
.sidebar-left { left: 0; transform: translateX(-100%); }
.sidebar-right { right: 0; transform: translateX(100%); }
body.left-open .sidebar-left { transform: translateX(0); }
body.right-open .sidebar-right { transform: translateX(0); }


.top-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 6px;
}
.top-links a {
  color: #333333;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.top-links a:hover {
  text-decoration: underline;
}
