:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --sidebar-bg: #f8f9fa;
    --border-color: #dee2e6;
    --toolbar-bg: #f1f3f5;
    --btn-bg: #ffffff;
    --primary: #4361ee;
    --danger: #ef233c;
    --line-color: #e9ecef;
    --gutter-bg: #f8f9fa;
    --gutter-text: #adb5bd;
    --ad-bg: #fdfdfd;
    --lh: 32px;
}

body.dark-mode {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --sidebar-bg: #1e1e1e;
    --border-color: #333;
    --toolbar-bg: #252525;
    --btn-bg: #2d2d2d;
    --line-color: #2c2c2c;
    --gutter-bg: #1e1e1e;
    --gutter-text: #666;
    --ad-bg: #1a1a1a;
}

.adsbygoogle {
    display: block !important;
    width: 100% !important;
    /* border : 10px solid orange; */
}

.ad-container {
    width: 250px;
    background: #ffffff;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0px;
    gap: 16px;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.05);
}

.ad-label {
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.ad-space {
    width: 100%;
    /* min-height: 600px; */
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0px;
    color: #64748b;
    font-size: 12px;
    text-align: center;
}

/* .ad-space {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 8px;
} */

/* .ad-space {
    display: inline-block;
    width: 300px;
    min-height: 80px;
    margin-right: 8px;
    vertical-align: top;
} */


/* Page Layout Fix */
.notepad-outer-wrapper {
    display: flex;
    height: calc(100vh - 150px);
    /* Navbar aur Footer ki height nikaal kar */
    min-height: 500px;
    position: relative;
    background-color: var(--bg-color);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: 0.3s;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    list-style: none;
    margin: 0;
}

#currentPageTitle,
.m-0 {
    color: var(--text-color);
}

.page-item {
    padding: 8px 12px;
    margin-bottom: 5px;
    background: var(--btn-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--text-color);
}

.page-item.active {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.1);
    font-weight: 500;
}

.page-actions {
    display: flex;
    gap: 8px;
}

.page-actions i {
    font-size: 12px;
    cursor: pointer;
    color: var(--gutter-text);
}

.page-actions i:hover {
    color: var(--primary);
}

.sidebar-footer {
    padding: 10px;
    border-top: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

/* Main Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.notepad-header-actions {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-color);
}

.toolbar {
    padding: 6px 15px;
    background: var(--toolbar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    overflow-x: auto;
    align-items: center;
}

.toolbar button {
    background: var(--btn-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
}

.btn-danger-icon {
    border: none;
    background: transparent;
    color: var(--danger);
    cursor: pointer;
    padding: 5px;
}

/* Editor Section */
.editor-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.line-numbers {
    width: 40px;
    background: var(--gutter-bg);
    color: var(--gutter-text);
    padding-top: 5px;
    text-align: right;
    padding-right: 8px;
    font-family: monospace;
    font-size: 13px;
    line-height: var(--lh);
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}

.editor-container {
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg-color);
    background-image: repeating-linear-gradient(transparent, transparent calc(var(--lh) - 1px), var(--line-color) calc(var(--lh) - 1px), var(--line-color) var(--lh));
    background-attachment: local;
}

.editor {
    width: 100%;
    min-height: 100%;
    outline: none;
    font-size: 16px;
    line-height: var(--lh);
    /* 32px */
    /* Padding-top ko 0 ya 5px rakhein taaki first line background se match kare */
    padding: 0px 15px 100px 15px;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-color);
}

.editor div,
.editor p {
    margin: 0 !important;
    padding: 0 !important;
    line-height: var(--lh) !important;
}

/* Ads */
.ad-slot {
    background: var(--ad-bg);
    border: 1px dashed var(--border-color);
    text-align: center;
}

.ad-mobile-top {
    display: none;
}

.ad-desktop-side {
    width: 160px;
    margin: 5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        display: none;
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }


    .ad-container {
        display: none;
    }

    .ad-mobile-top {
        height: 70px;
        margin: 5px;
        display: block;
    }
}

/* Modal Custom */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content-custom {
    background: var(--bg-color);
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}