/* css/page.css */

/* General styles for sub-pages to ensure content appears below the fixed header */
body.sub-page .page-content {
  padding-top: 120px; /* Increased padding to accommodate utility bar */
  background: #f4f6f9;
}

/* A wrapper for consistent padding and max-width */
.page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem 2rem;
}

/* NEW: Sidebar Layout */
.page-container.with-sidebar {
    max-width: 1400px;
    display: grid;
    grid-template-columns: 1fr 350px; /* Main content and sidebar */
    gap: 2.5rem;
    align-items: flex-start;
}

.main-content {
    /* This will occupy the first column */
}

.page-sidebar {
    position: sticky;
    top: 140px; /* Header height + some padding */
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
    visibility: hidden;
}

.page-sidebar.visible {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
}


/* Page header section */
.page-header {
  padding: 3rem 2rem;
  background: var(--dark);
  color: var(--light);
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative; /* Added for button positioning */
}

.page-header h1 {
  font-size: 2.8rem;
  margin: 0;
  font-weight: 700;
}

/* NEW: Upload button styles */
.upload-button {
    position: absolute;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: none; /* MODIFIED: Hide by default */
    align-items: center;
    gap: 8px;
}

.upload-button:hover {
    background-color: #3367d6;
    transform: translateY(-50%) scale(1.05);
}

/* Content styles */
.content-section {
  background: #fff;
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
}

.content-section h2 {
  font-size: 2rem;
  color: var(--primary);
  margin-top: 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #eee;
  margin-bottom: 1.5rem;
}

.content-section p {
  line-height: 1.7;
  font-size: 1.1rem;
  color: #333;
}

/* Service cards grid */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.service-card {
  padding: 2rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  text-align: left; /* MODIFIED: For better readability */
  transition: all 0.3s ease;
  background: #fff;
}

.service-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(66, 133, 244, 0.2);
  border-color: var(--primary);
}

.service-card i {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.service-card h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--dark);
}

.service-card p {
    font-size: 1rem;
    color: var(--gray);
    line-height: 1.6;
}

/* Contact Page Styles */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 3rem;
  align-items: flex-start;
}

.contact-details p {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    color: #333;
    display: flex;
    align-items: flex-start;
}

.contact-details p i {
  margin-right: 15px;
  margin-top: 5px;
  color: var(--primary);
  width: 20px;
  text-align: center;
}

.contact-map .map-container {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #ddd;
  height: 400px;
}
.contact-map .map-container iframe {
    height: 100%;
}

/* NEW: Contact Social Section */
.contact-social {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.contact-social h3 {
    font-size: 1.5rem;
    color: var(--dark);
    margin-top: 0;
    margin-bottom: 1rem;
}

.contact-social .social-icons {
    display: flex;
    gap: 1rem;
}

.contact-social .social-icons a {
    font-size: 1.8rem;
    color: var(--gray);
    transition: color 0.2s ease, transform 0.2s ease;
}

.contact-social .social-icons a:hover {
    color: var(--primary);
    transform: scale(1.1);
}

/* Post List & Detail Styles */
.post-item {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    margin-bottom: 2.5rem;
    overflow: hidden;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

#post-list-container .post-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.post-item-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.post-item-image-link {
    display: block;
}

.post-item-content {
    padding: 2.5rem;
}

.post-item-title {
    font-size: 2.2rem;
    margin-top: 0;
    margin-bottom: 1rem;
}

.post-item-title a {
    text-decoration: none;
    color: var(--dark);
    transition: color 0.2s ease;
}

.post-item-title a:hover {
    color: var(--primary);
}

.post-item-meta {
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

.post-item-tags {
    margin-bottom: 1.5rem;
}

.post-item-tags .tag {
    display: inline-block;
    background-color: #eef4ff;
    color: var(--primary);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 8px;
    margin-bottom: 8px;
}

.post-item-body, .post-item-excerpt {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
}
.post-item-body p:first-child, .post-item-excerpt p:first-child { margin-top: 0; }
.post-item-body p:last-child, .post-item-excerpt p:last-child { margin-bottom: 0; }

.post-item-excerpt {
    margin-bottom: 1.5rem;
}

.post-item-gallery {
    margin: 2rem 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}
.post-item-gallery img {
    width: 100%;
    border-radius: 8px;
}

.read-more-btn {
    display: inline-block;
    background-color: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.read-more-btn:hover {
    background-color: #3367d6;
    transform: translateY(-2px);
}

/* Promo Page Styles */
.promo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}
.promo-card {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    border-left: 5px solid var(--primary);
}
.promo-card h3 {
    margin-top: 0;
    font-size: 1.5rem;
}
.promo-code-wrapper {
    margin-top: 1.5rem;
    padding: 0.8rem;
    background: #f4f6f9;
    border-radius: 8px;
    text-align: center;
}
.promo-code-label {
    display: block;
    font-size: 0.9rem;
    color: var(--gray);
}
.promo-code {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 2px;
}
.promo-validity {
    margin-top: 1rem;
    font-size: 0.9rem;
    text-align: center;
    color: var(--gray);
}

/* Schedule Detail Page Styles */
.schedule-detail-page .content-section p {
    margin-bottom: 1.5rem;
}
.schedule-detail-page .content-section p:last-child {
    margin-bottom: 0;
}

/* About Page - LEGO Steps Section */
.about-page .page-container {
    max-width: 1600px;
}

.about-page .content-section {
    background-color: #0053a0;
    background-image: url('data:image/svg+xml;utf8,<svg width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><g fill="%23004a90" fill-opacity="0.4" fill-rule="evenodd"><circle cx="5" cy="5" r="4"/><circle cx="25" cy="5" r="4"/><circle cx="5" cy="25" r="4"/><circle cx="25"cy="25" r="4"/></g></svg>');
    padding: 4rem 2rem 2rem;
    position: relative;
    overflow: visible; /* Allow mascot to overlap */
}

.about-steps-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Always 4 columns on large screens */
    gap: 2rem;
    align-items: stretch;
    position: relative;
    z-index: 2;
}

.about-step {
    padding: 1rem 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

.about-step-content {
    background: #fff;
    border-radius: 8px;
    border: 4px solid white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 4rem; /* space for the label */
    overflow: hidden;
    min-height: 350px;
}

.about-step-number {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    background-color: #ff8c00; /* Orange */
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    border: 3px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 10;
}

.about-step-image-wrapper {
    flex-grow: 1;
}

.about-step-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.about-step-text-wrapper {
    flex-grow: 1;
    background-color: #003a70;
    color: white;
    padding: 3rem 1.5rem 1.5rem;
    font-size: 1.1rem;
    line-height: 1.6;
    display: flex;
    align-items: center;
}

.about-step-label {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    background-color: #ff8c00; /* Orange */
    color: white;
    padding: 1rem;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    z-index: 5;
}

.about-page-mascot {
    position: absolute;
    bottom: 0px;
    right: 50px;
    width: 200px;
    height: auto;
    z-index: 3;
    pointer-events: none;
    transform: translateY(20px);
}

/* Sidebar Specific Content Styles */
.sidebar-content-box {
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
}
.sidebar-content-box h3 {
    margin-top: 0;
    font-size: 1.3rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid #eee;
    margin-bottom: 1rem;
}
/* Sidebar Post List */
.sidebar-post-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-post-item {
    margin-bottom: 1rem;
}
.sidebar-post-item:last-child {
    margin-bottom: 0;
}
.sidebar-post-item a {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: var(--dark);
    transition: background-color 0.2s ease;
    padding: 8px;
    border-radius: 8px;
}
.sidebar-post-item a:hover {
    background-color: #f4f6f9;
}
.sidebar-post-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}
.sidebar-post-item span {
    font-weight: 500;
    line-height: 1.4;
    font-size: 0.95rem;
}

/* Sidebar Gallery */
.sidebar-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.sidebar-gallery img {
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.sidebar-gallery img:hover {
    transform: scale(1.05);
}

/* UPDATED: Sidebar Ad Poster for Rotator */
.sidebar-ad-poster {
    border-radius: 8px;
    overflow: hidden;
    line-height: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative; /* Needed for absolute positioning of children */
    min-height: 350px; /* Give it a height to prevent collapse */
}

.sidebar-ad-poster:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.sidebar-ad-poster a {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.7s ease-in-out, visibility 0s linear 0.7s;
}

.sidebar-ad-poster a.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.7s ease-in-out, visibility 0s linear 0s;
}

.sidebar-ad-poster img {
    width: 100%;
    height: auto;
    display: block;
}


@media (max-width: 1200px) {
    .about-steps-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .page-container.with-sidebar {
        grid-template-columns: 1fr;
    }
    .page-sidebar {
        position: static;
        top: auto;
        margin-top: 2rem;
    }
}

@media (max-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .about-steps-container {
      grid-template-columns: 1fr;
  }
  .about-page-mascot {
      display: none;
  }
  .upload-button {
      position: static;
      transform: none;
      margin-top: 1.5rem;
      width: 100%;
      justify-content: center;
  }
  .page-header h1 {
      margin-bottom: 0.5rem;
  }
}