/**
 * Reusable 50/50 Split Layout Styles
 * File: assets/css/split-layout.css
 */

html, body.login { /* Keep targeting body.login for login page reset */
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent scrollbars caused by layout */
}

/* Main Wrapper */
.aibookgen-split-layout { /* Renamed from .aibookgen-login-wrapper */
    display: flex;
    min-height: 100vh; /* Ensure wrapper takes full viewport height */
    width: 100%;
}

/* Left Image Column */
.aibookgen-split-layout__image-col { /* Renamed */
    width: 50%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    position: relative; /* For positioning the overlay text */
    overflow: hidden; /* Hide text overflow */
}

/* Overlay Text */
.aibookgen-split-layout__overlay-text { /* Renamed */
    position: absolute;
    top: 20px; /* Adjust position from top */
    left: 0;
    width: 100%;
    font-size: 6vw; /* Responsive font size based on viewport width */
    font-weight: 700;
    color: white;
    mix-blend-mode: difference; /* Key for the inverted effect */
    line-height: 1.1;
    white-space: nowrap; /* Prevent text wrapping */
    pointer-events: none; /* Allow clicks to pass through */
    overflow: hidden;
    text-transform: uppercase;
}

.aibookgen-split-layout__overlay-text span { /* Renamed */
    display: inline-block; /* Needed for potential animation */
    padding-left: 100%; /* Start text off-screen if animating */
}

/* Right Content Column */
.aibookgen-split-layout__content-col { /* Renamed from .aibookgen-login-form-col */
    width: 50%;
    background-color: #181d18; /* Black background */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px; /* Add some padding */
    box-sizing: border-box;
    position: relative; /* For potential absolute positioning inside */
    overflow-y: auto; /* Allow content column to scroll if needed */
}

/* --- Styles for Content within the Split Layout (e.g., 50x50 template) --- */

/* Wrapper for centering content in the right column */
.aibookgen-split-content-wrapper {
    width: 100%;
    max-width: 600px; /* Adjust max-width as needed */
    padding: 0; /* Remove #login padding */
    margin: 0 auto; /* Center the content block */
    color: rgba(255, 255, 255, 0.85); /* Default text color for content */
}

.aibookgen-split-content .entry-content {
    /* General styles for content within the right column */
}

.aibookgen-split-content .entry-content h1,
.aibookgen-split-content .entry-content h2,
.aibookgen-split-content .entry-content h3,
.aibookgen-split-content .entry-content h4,
.aibookgen-split-content .entry-content h5,
.aibookgen-split-content .entry-content h6 {
    color: #ffffff;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.aibookgen-split-content .entry-content p {
    margin-bottom: 1em;
    line-height: 1.7;
}

.aibookgen-split-content .entry-content a {
    color: var(--aibookgen-color-primary-light, #73a3cc); /* Lighter primary for dark bg */
    text-decoration: underline;
}

.aibookgen-split-content .entry-content a:hover {
    color: #ffffff;
}

.aibookgen-split-content .entry-content ul,
.aibookgen-split-content .entry-content ol {
    margin-bottom: 1em;
    margin-left: 1.5em;
}

.aibookgen-split-content .entry-content li {
    margin-bottom: 0.5em;
}

.aibookgen-split-content .entry-content blockquote {
    border-left: 3px solid var(--aibookgen-color-primary, #007cba);
    padding-left: 1em;
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 1em;
    font-style: italic;
    color: rgba(255, 255, 255, 0.7);
}

.aibookgen-split-content .entry-content pre {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 1em;
    overflow-x: auto;
    border-radius: var(--aibookgen-border-radius, 4px);
    color: rgba(255, 255, 255, 0.8);
}

.aibookgen-split-content .entry-content code {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

/* --- Added Styles for Create Page / 50x50 Templates --- */

/* Relative positioning for image column (already exists, ensure it has overflow) */
.aibookgen-split-layout__image-col {
    position: relative; /* Context for absolute leaves */
    overflow: hidden; /* Contain the leaves */
}

/* Overlay text styling (ensure it's above leaves) */
.aibookgen-split-layout__overlay-text {
    position: relative; /* To allow z-index */
    z-index: 2; /* Above leaves */
}

/* Padding for content column (modified existing rule) */
.aibookgen-split-layout__content-col {
    position: relative; /* Needed for absolute positioning of children */
    padding-top: 80px; /* Add padding again for top-aligned absolute menu */
    padding-left: 30px; 
    /* Remove large right padding */
    /* padding-right: 100px; */ 
    padding-right: 30px; /* Restore default padding */
    padding-bottom: 30px; 
}

/* Padding for content wrapper */
.aibookgen-split-content-wrapper {
    /* padding-bottom: 100px; */ /* Removed padding for bottom toggle */
}

/* Toggle Switch CSS */
.switch-holder {
    position: absolute; /* Position relative to content-col */
    bottom: 30px; /* Space from bottom */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%); /* Adjust for element width */
    display: flex;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: -8px -8px 15px rgb(28 28 28 / 70%), 10px 10px 10px rgba(0, 0, 0, .3), inset 8px 8px 15px rgb(0 0 0 / 70%), inset 10px 10px 10px rgb(53 52 52 / 30%);
    justify-content: space-between;
    align-items: center;
    max-width: 300px;
    z-index: 10; /* Ensure it's above other content if overlap occurs */
}

.switch-label {
    width: 150px;
    color: var(--aibookgen-color-split-text);
    /* Match text color */
}

.switch-label i {
    margin-right: 10px;
    /* Increased spacing */
    width: 20px;
    /* Align icon */
    text-align: center;
    display: none;
}

.switch-toggle {
    height: 40px;
}

.switch-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    z-index: -2;
}

.switch-toggle input[type="checkbox"]+label {
    position: relative;
    display: inline-block;
    width: 100px;
    height: 40px;
    border-radius: 20px;
    margin: 0;
    cursor: pointer;
    background-color: transparent;
    /* Use background from parent */
    box-shadow: inset -8px -8px 15px rgb(0 0 0 / 60%), inset 10px 10px 10px rgba(0, 0, 0, .25);
}

.switch-toggle input[type="checkbox"]+label::before {
    position: absolute;
    content: 'OFF';
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    line-height: 25px;
    top: 8px;
    left: 8px;
    width: 45px;
    height: 25px;
    border-radius: 20px;
    /* background-color: #d1dad3; */
    /* Match Neumorphism background */
    background-color: rgba(0, 0, 0, .15);
    /* Darker indicator */
    color: var(--aibookgen-color-split-text);
    box-shadow: -3px -3px 5px rgba(255, 255, 255, .5),
        3px 3px 5px rgba(0, 0, 0, .25);
    transition: .3s ease-in-out;
}

.switch-toggle input[type="checkbox"]:checked+label::before {
    left: 50%;
    content: 'ON';
    color: #fff;
    background-color: #00b33c;
    box-shadow: -3px -3px 5px rgb(58 58 58 / 50%), 3px 3px 5px #1c4e2d;
}
 /* Hide default audio player */
 #background-audio {
    display: none;
 }

/* --- Falling Leaves CSS --- */
#leaves {
    position: absolute; /* Position within image col */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* Below overlay text */
}

#leaves i {
    display: inline-block;
    width: 200px; /* Base size, overridden below */
    height: 150px;
    background: linear-gradient(to bottom right, #309900, #005600);
    transform: skew(20deg);
    border-radius: 5% 40% 70%;
    box-shadow: inset 0px 0px 1px #222;
    border: 1px solid #333;
    position: absolute; /* Needed for animation origin */
    top: -150px; /* Start above the container */
    left: -200px; /* Start outside left edge initially */
    -webkit-animation: falling 10s 0s infinite;
    animation: falling 10s 0s infinite;
    /* Ensure animation is running by default */
    animation-play-state: running;
    -webkit-animation-play-state: running;
}

/* Pause animation when the container has the .leaves-paused class */
#leaves.leaves-paused i {
    animation-play-state: paused;
    -webkit-animation-play-state: paused;
    opacity: 0; /* Optionally hide leaves when paused */
    transition: opacity 0.5s ease-out; /* Smooth hiding */
}

#leaves i:nth-of-type(2n) { -webkit-animation-name: falling2; animation-name: falling2; }
#leaves i:nth-of-type(3n) { -webkit-animation-name: falling3; animation-name: falling3; }

#leaves i:before {
  position: absolute;
  content: '';
  top: 117px; /* Adjusted by nth-of-type */
  right: 9px;
  height: 27px;
  width: 32px;
  transform: rotate(49deg);
  border-radius: 0% 15% 15% 0%;
  border-top: 1px solid #222;
  border-bottom: 1px solid #222;
  border-left: 0px solid #222;
  border-right: 1px solid #222;
  background: linear-gradient(to right, rgba(0,100,0,1), #005600);
  z-index: 1;
}

#leaves i:after {
  content: '';
  height: 125px; /* Adjusted by nth-of-type */
  width: 10px;
  background: linear-gradient(to right, rgba(0,0,0,.15), rgba(0,0,0,0));
  display: block;
  transform: rotate(125deg);
  position: absolute;
  left: 85px;
  border-radius:50%;
}

/* Leaf Size Variations */
#leaves i:nth-of-type(n)    { height:23px; width:30px; } /* Small */
#leaves i:nth-of-type(n):before { width:7px; height:5px; top:17px; right:1px; }
#leaves i:nth-of-type(n):after { width:2px; height:17px; left: 12px; top:0px; }

#leaves i:nth-of-type(2n+1) { height:11px; width:16px; } /* Extra Small */
#leaves i:nth-of-type(2n+1):before { width:4px; height:3px; top:7px; right:0px; }
#leaves i:nth-of-type(2n+1):after { width:2px; height:6px; left: 5px; top:1px; }

#leaves i:nth-of-type(3n+2) { height:17px; width:23px; } /* Medium */
#leaves i:nth-of-type(3n+2):before { height:4px; width:4px; top:12px; right:1px; }
#leaves i:nth-of-type(3n+2):after { height:10px; width:2px; top:1px; left:8px; }

/* Leaf Animation Delays & Timing */
#leaves i:nth-of-type(n)   { animation-delay: 1.9s; -webkit-animation-delay: 1.9s;}
#leaves i:nth-of-type(2n)  { animation-delay: 3.9s; -webkit-animation-delay: 3.9s;}
#leaves i:nth-of-type(3n)  { animation-delay: 2.3s; -webkit-animation-delay: 2.3s;}
#leaves i:nth-of-type(4n)  { animation-delay: 4.4s; -webkit-animation-delay: 4.4s;}
#leaves i:nth-of-type(5n)  { animation-delay: 5s;   -webkit-animation-delay: 5s;  }
#leaves i:nth-of-type(6n)  { animation-delay: 3.5s; -webkit-animation-delay: 3.5s;}
#leaves i:nth-of-type(7n)  { animation-delay: 2.8s; -webkit-animation-delay: 2.8s;}
#leaves i:nth-of-type(8n)  { animation-delay: 1.5s; -webkit-animation-delay: 1.5s;}
#leaves i:nth-of-type(9n)  { animation-delay: 3.3s; -webkit-animation-delay: 3.3s;}
#leaves i:nth-of-type(10n) { animation-delay: 2.5s; -webkit-animation-delay: 2.5s;}
#leaves i:nth-of-type(11n) { animation-delay: 1.2s; -webkit-animation-delay: 1.2s;}
#leaves i:nth-of-type(12n) { animation-delay: 4.1s; -webkit-animation-delay: 4.1s;}
#leaves i:nth-of-type(13n) { animation-delay: 1s;   -webkit-animation-delay: 1s;  }
#leaves i:nth-of-type(14n) { animation-delay: 4.7s; -webkit-animation-delay: 4.7s;}
#leaves i:nth-of-type(15n) { animation-delay: 3s;   -webkit-animation-delay: 3s;  }

/* Leaf Color Variations */
#leaves i:nth-of-type(n)    { background: linear-gradient(to bottom right, #309900, #005600); }
#leaves i:nth-of-type(2n+2) { background: linear-gradient(to bottom right, #5e9900, #2b5600); }
#leaves i:nth-of-type(4n+1) { background: linear-gradient(to bottom right, #990, #564500); } /* More yellowish */

/* Leaf Opacity Variations */
#leaves i:nth-of-type(n)    { opacity: .7;}
#leaves i:nth-of-type(3n+1) { opacity: .5;}
#leaves i:nth-of-type(3n+2) { opacity: .3;}

#leaves i:nth-of-type(n) { animation-timing-function:ease-in-out; -webkit-animation-timing-function:ease-in-out;}

/* Keyframes */
@keyframes falling {
    0% {
        transform: translate3d(10vw, -150px, 0) rotate(0deg); /* Start near top, across width */
        left: 10%; /* Vary start position */
    }
    100% {
        transform: translate3d(calc(10vw - 350px), 110vh, 0) rotate(90deg); /* End below viewport */
        opacity: 0;
        left: 0%; /* Adjust end position */
    }
}
@-webkit-keyframes falling {
     0% { -webkit-transform: translate3d(10vw, -150px, 0) rotate(0deg); left: 10%; }
    100% { -webkit-transform: translate3d(calc(10vw - 350px), 110vh, 0) rotate(90deg); opacity: 0; left: 0%; }
}

@keyframes falling3 {
     0% {
        transform: translate3d(70vw, -150px, 0) rotate(-20deg);
        left: 70%;
    }
    100% {
        transform: translate3d(calc(70vw - 230px), 110vh, 0) rotate(-70deg);
        opacity: 0;
        left: 80%;
    }
}
 @-webkit-keyframes falling3 {
     0% { -webkit-transform: translate3d(70vw, -150px, 0) rotate(-20deg); left: 70%; }
    100% { -webkit-transform: translate3d(calc(70vw - 230px), 110vh, 0) rotate(-70deg); opacity: 0; left: 80%; }
}

@keyframes falling2 {
     0% {
        transform: translate3d(40vw, -150px, 0) rotate(90deg);
        left: 40%;
    }
    100% {
        transform: translate3d(calc(40vw - 400px), 110vh, 0) rotate(0deg);
        opacity: 0;
         left: 50%;
    }
}
@-webkit-keyframes falling2 {
     0% { -webkit-transform: translate3d(40vw, -150px, 0) rotate(90deg); left: 40%; }
    100% { -webkit-transform: translate3d(calc(40vw - 400px), 110vh, 0) rotate(0deg); opacity: 0; left: 50%; }
}

/* --- End Falling Leaves CSS --- */

/* --- Create Page Menu Styles --- */
.create-page-navigation {
    position: absolute; 
    top: 30px; 
    right: 30px; 
    z-index: 20; 
    display: flex; /* Align menu and toggle */
    align-items: center;
    gap: 10px; /* Space between menu and toggle */
}

.create-page-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex; /* Horizontal layout */
    flex-wrap: wrap; 
    /* Removed justify-content, let gap control spacing */
    /* justify-content: flex-end; */ 
    gap: 10px; 
}

.create-page-menu li {
     /* Remove bottom margin used for vertical */
     margin-bottom: 0; 
}

.create-page-menu a {
    display: block;
    padding: 8px 15px;
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--aibookgen-color-split-text);
    text-decoration: none;
    border-radius: 5px;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
    white-space: nowrap; /* Prevent text wrapping within button */
}

.create-page-menu a:hover,
.create-page-menu .current-menu-item > a {
    background-color: rgba(0, 0, 0, 0.4);
    color: #fff;
}

/* --- Styles for Toggle Switch integrated into Menu --- */
.menu-toggle-switch {
    /* Reset original positioning and shadow */
    position: static;
    transform: none;
    bottom: auto;
    left: auto;
    box-shadow: none;
    padding: 0;
    margin: 0; 
    max-width: none;
    /* Align items vertically */
    display: flex;
    align-items: center;
    /* Add background/border similar to menu items */
    background-color: rgba(0, 0, 0, 0.2); 
    border-radius: 5px; 
    /* Match padding of menu items (adjust as needed) */
    padding: 8px 15px; 
    height: auto; /* Let content dictate height */
}

.menu-toggle-switch .switch-label {
    width: auto; /* Don't force width */
    color: var(--aibookgen-color-split-text); 
    font-size: 0.9em; /* Match menu item font size */
    margin-right: 10px; /* Space between label and toggle */
    display: inline-flex; /* Align icon and text */
    align-items: center;
}

.menu-toggle-switch .switch-label i {
    display: inline-block; /* Show icon */
    margin-right: 5px; /* Space icon from text */
    /* Inherit color from label */
}

.menu-toggle-switch .switch-toggle {
    height: 24px; /* Reduced height */
}

.menu-toggle-switch .switch-toggle input[type="checkbox"] + label {
    width: 50px; /* Reduced width */
    height: 24px; /* Reduced height */
    border-radius: 12px; /* Adjust border-radius */
    box-shadow: inset -4px -4px 8px rgb(0 0 0 / 60%), inset 5px 5px 5px rgba(0, 0, 0, .25); /* Scale down shadow */
}

.menu-toggle-switch .switch-toggle input[type="checkbox"] + label::before {
    /* Adjust size and position */
    font-size: 10px; 
    line-height: 16px; 
    top: 4px; 
    left: 4px; 
    width: 22px; /* Adjust width */
    height: 16px; 
    border-radius: 10px; 
    box-shadow: -2px -2px 3px rgba(255, 255, 255, .5), 2px 2px 3px rgba(0, 0, 0, .25); /* Scale down shadow */
}

.menu-toggle-switch .switch-toggle input[type="checkbox"]:checked + label::before {
    left: 24px; /* Adjust position */
    box-shadow: -2px -2px 3px rgb(58 58 58 / 50%), 2px 2px 3px #1c4e2d; /* Scale down shadow */
}

/* Remove original .switch-holder styles (unless needed elsewhere) */
/* .switch-holder { ... } */ 

/* --- End Create Page Menu Styles --- */

/* Responsive adjustments combining menu and original padding */
@media (max-width: 782px) { 
    /* ... other existing responsive rules ... */

    .aibookgen-split-layout__content-col {
        padding-top: 60px; 
        padding-left: 15px;
        padding-right: 15px; 
        padding-bottom: 15px; 
    }

    .create-page-navigation {
          top: 15px;
          right: 15px;
          left: 15px; /* Make it span width on mobile */
          width: auto;
          gap: 10px; /* Adjust gap */
          justify-content: space-between; /* Space out menu and toggle */
     }
      .create-page-menu {
         /* Keep gap, but maybe justify start? */
         /* justify-content: flex-start; */
         gap: 5px;
     }
     .create-page-menu a,
     .menu-toggle-switch {
         padding: 6px 10px; /* Consistent padding */
         font-size: 0.85em;
    }
    .menu-toggle-switch .switch-label {
         font-size: 0.85em; /* Match font size */
    }
    /* Adjust toggle size/position slightly more if needed */

    /* Remove original switch holder bottom style */
    /* .switch-holder { bottom: 15px; } */

    /* ... other existing responsive rules ... */
} 