/* ==========================================================================
   Global Styles & Variables
   ========================================================================== */
:root {
    --primary-color: #1273eb;
    --secondary-color: #0d5cbb;
    --light-gray: #f4f7f6;
    --border-color: #e0e0e0;
    --dark-text: #333;
    --white-color: #ffffff;
    --ad-placeholder-bg: #e9e9e9;
    --ad-placeholder-text: #777;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: var(--light-gray);
    color: var(--dark-text);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

* {
    box-sizing: border-box;
}

/* ==========================================================================
   Header & Footer
   ========================================================================== */
.main-header {
    background-color: var(--primary-color);
    color: var(--white-color);
    text-align: center;
    padding: 1rem 1rem;
    width: 100%;
}

.main-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 2.5rem;
}

.main-footer {
    background-color: #333;
    color: #ccc;
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: auto; /* Pushes footer to the bottom */
    width: 100%;
}

.footer-links a {
    color: var(--white-color);
    text-decoration: none;
    margin: 0 15px;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Layout & Ad Spaces
   ========================================================================== */


.main-container {
    display: flex;
    width: 100%;
    max-width: 1600px;
    margin: 1.5rem auto;
    padding: 0 1.5rem;
    gap: 1.5rem;
    flex: 1; /* Allows the container to grow and fill available space */
}

.left-ad-space, .right-ad-space {
    width: 160px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-style: italic;

    /* Add these 3 lines for the sticky effect */
    position: -webkit-sticky; /* For Safari */
    position: sticky;
    top: 100px; /* The 100px offset from the top */
    align-self: flex-start; /* Ensures proper alignment in the container */
}

.content-area {
    flex: 1; /* Takes up the remaining space */
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevents content from overflowing */
}

/* ==========================================================================
   Main Content: Notepad, Blog, Pages
   ========================================================================== */
.notepad-container,
.blogs-section,
.page-content {
    background: var(--white-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.blogs-section {
    margin-top: 2rem;
    text-align: center;
}

.btn-primary {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--white-color);
    padding: 12px 24px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
}

/* ==========================================================================
   Custom Editor Styles
   ========================================================================== */
.editor-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 8px;
    background-color: #f0f0f0;
    border-bottom: 1px solid var(--border-color);
}

.toolbar-btn {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    margin: 2px;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
}

.toolbar-btn:hover {
    background-color: #e0e0e0;
    border-color: #b9b9b9;
}

.toolbar-btn b, .toolbar-btn i, .toolbar-btn u {
    font-family: 'Times New Roman', serif;
}

.separator {
    width: 1px;
    height: 20px;
    background-color: #ccc;
    margin: 0 8px;
}

.editable-area {
    min-height: 400px;
    padding: 1rem;
    outline: none;
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: var(--white-color);
}

/* ==========================================================================
   Mobile Responsiveness
   ========================================================================== */
@media (max-width: 1024px) {
    .left-ad-space, .right-ad-space {
        display: none; /* Hide side ads on tablets and smaller */
    }
    .main-container {
        padding: 0 1rem;
    }
}

@media (max-width: 768px) {
    .main-header h1 {
        font-size: 2rem;
    }
    .main-container {
        padding: 0;
        margin: 0;
    }
    .notepad-container,
    .blogs-section,
    .page-content {
        border-radius: 0;
        padding: 1.5rem;
    }
    .footer-links a {
        display: block;
        margin: 10px 0;
    }
}

/* --- Additional Editor Styles --- */
.toolbar-select {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px;
    margin: 2px 4px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}

.toolbar-select:hover {
    background-color: #e0e0e0;
    border-color: #b9b9b9;
}

/* --- Source Code View Styles --- */
.source-code-view {
    display: none; /* Hidden by default */
    width: 100%;
    min-height: 400px;
    border: none;
    outline: none;
    resize: vertical;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    background-color: #2b2b2b;
    color: #f0f0f0;
}

/* When source view is active, hide the normal editor */
.source-view-active .editable-area {
    display: none;
}

/* When source view is active, show the code textarea */
.source-view-active .source-code-view {
    display: block;
}

/* --- Feature Section Styles --- */
.feature-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 2rem; /* <-- Add this line to create the gap */
    text-align: center;
}

.feature-card {
    background-color: var(--white-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    position: relative; /* Required for the animation */
    overflow: hidden;   /* Hides the overlay initially */
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-10px); /* Lifts the card on hover */
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-top: 0;
    color: var(--primary-color);
}

/* The Cover Animation Overlay */
.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-color);
    opacity: 0;
    transform: scale(0);
    transition: all 0.4s ease-in-out;
    z-index: 1;
}

.feature-card:hover::before {
    opacity: 0.9;
    transform: scale(1);
}

/* Keep text on top of the overlay */
.feature-card > * {
    position: relative;
    z-index: 2;
    transition: color 0.3s ease;
}

.feature-card:hover > * {
    color: var(--white-color);
}

.feature-card:hover h3 {
    color: var(--white-color); /* Ensure heading color changes too */
}

/* Responsive adjustments for the feature section */
@media (max-width: 900px) {
    .feature-section {
        grid-template-columns: 1fr; /* Stack columns on smaller screens */
    }
}

/* --- About Us Section Styles --- */
.about-section {
    background-color: var(--white-color);
    padding: 3rem 1.5rem;
    margin-top: 2rem;
}

.about-container {
    max-width: 800px; /* Optimal width for readability */
    margin: 0 auto;
    text-align: left;
}

.about-section h2,
.about-section h3,
.about-section h4 {
    color: var(--dark-text);
    margin-bottom: 1rem;
}

.about-section h2 {
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.about-section h3 {
    font-size: 1.8rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-top: 2.5rem;
}

.about-section h4 {
    font-size: 1.4rem;
    margin-top: 2rem;
}

.about-section p {
    font-size: 1.1rem;
    line-height: 1.7; /* Increased line-height for easier reading */
    color: #555;
}

.about-section .about-intro {
    font-size: 1.2rem;
    font-style: italic;
    color: #444;
    text-align: center;
    margin-bottom: 2.5rem;
}

.about-features ul {
    list-style-type: none;
    padding-left: 0;
}

.about-features li {
    font-size: 1.1rem;
    color: #555;
    padding-left: 30px;
    position: relative;
    margin-bottom: 1rem;
    line-height: 1.7;
}

.about-features li::before {
    content: '✔';
    color: var(--primary-color);
    position: absolute;
    left: 0;
    top: 0;
    font-weight: bold;
}

/* --- FAQ Section Styles --- */
.faq-section {
    padding: 3rem 1.5rem;
    background-color: var(--light-gray);
}

.faq-section h2 {
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: 2rem;
    color: var(--dark-text);
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background-color: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden; /* Important for the animation */
}

.faq-question {
    width: 100%;
    background-color: transparent;
    border: none;
    padding: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--dark-text);
}

.faq-icon {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.faq-answer {
    max-height: 0; /* Hidden by default */
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
}

.faq-answer p {
    padding: 0 1.5rem 1.5rem;
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #555;
}

/* Styles for the active/open state */
.faq-item.active .faq-answer {
    max-height: 300px; /* Adjust if your answers are longer */
    padding-top: 0;
}



/* --- Responsive Ad Styles --- */

/* Default styles for desktop */
.ad-mobile {
    display: none; /* Hide mobile ad on desktop */
}
.ad-desktop {
    display: inline-block; /* Show desktop ad by default */
}

/* Styles for mobile screens (768px wide or less) */
@media (max-width: 768px) {
    .ad-desktop {
        display: none; /* Hide desktop ad on mobile */
    }
    .ad-mobile {
        display: inline-block; /* Show mobile ad on mobile */
    }
}

.top-ad-space {
    padding: 0.3rem;
    
    min-height: 90px;
    width: 100%x;
    
    /* Add these two lines to center the content */
    display: flex;
    justify-content: center;
}


/* --- Legal Page Readability Styles --- */
.legal-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
}

.legal-container h3 {
    font-size: 1.6rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.legal-container p, .legal-container li {
    font-size: 1rem;
    line-height: 1.8;
    color: #444;
}

.legal-container ul {
    list-style-type: disc;
    padding-left: 20px;
}

.legal-container a {
    color: var(--primary-color);
    text-decoration: none;
}

.legal-container a:hover {
    text-decoration: underline;
}

.effective-date {
    font-style: italic;
    color: #777;
    text-align: center;
    margin-bottom: 2rem;
}

/* --- Contact Form Styles --- */
.contact-container {
    max-width: 700px;
    margin: 0 auto;
}

.contact-intro {
    text-align: center;
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-text);
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.contact-form input[type="text"]:focus,
.contact-form input[type="email"]:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(18, 115, 235, 0.2);
}

.contact-form textarea {
    resize: vertical;
}

.contact-form button[type="submit"] {
    width: 100%;
    border: none;
    font-size: 1.1rem;
}

.form-success-message {
    text-align: center;
    background-color: #eef4ff;
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--primary-color);
}

/* --- Auto-Save Status Styles --- */
#autosave-status {
    font-size: 13px;
    font-weight: 500;
    margin-left: -5px; /* Pulls it closer to the button */
    margin-right: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--white-color);
    transition: background-color 0.3s ease;
}

#autosave-status.on {
    background-color: #28a745; /* Green for ON */
}

#autosave-status.off {
    background-color: #6c757d; /* Gray for OFF */
}

/* --- Share Link Styles --- */
.share-link-wrapper {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #eef4ff;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
}
.share-link-wrapper label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}
.share-link-input-group {
    display: flex;
    gap: 10px;
}
#share-link-input {
    width: 100%;
    flex-grow: 1;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 5px;
    background-color: #fff;
    font-size: 1rem;
}
#copy-link-button {
    border: none;
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}
#copy-link-button:hover {
    background-color: var(--secondary-color);
}

/* --- Color Picker Styles --- */
.color-picker-wrapper {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 32px;
    margin: 2px;
}

.color-picker-wrapper label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    cursor: pointer;
    border-radius: 4px;
    border: 1px solid transparent;
}

.color-picker-wrapper label:hover {
    background-color: #e0e0e0;
    border-color: #b9b9b9;
}

.color-picker-wrapper .color-input {
    /* This hides the default input but keeps it functional */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}