/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

:root {
    --primary-color: #3a7bd5;
    --secondary-color: #00d2ff;
    --dark-color: #333;
    --light-color: #f4f4f4;
    --danger-color: #dc3545;
    --success-color: #28a745;
    --wood-color: #ebd6af;
    --wood-dark: #c29a6b;
    --brown-color: #8B4513;
    --paper-color: #fff;
    --line-color: rgba(0,0,200,0.1);
}

body {
    min-height: 100vh;
    background: linear-gradient(to right, var(--wood-color), var(--wood-dark));
    background-image: url('../images/wood.png');
    background-size: cover;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 5px;
}

/* Main Layout */
.main-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 1400px;
    min-height: 90vh;
    height: auto;
    position: relative;
}

/* Sidebar Toggle Button (Hamburger) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    border-radius: 5px;
    border: none;
    background-color: var(--brown-color);
    color: white;
    font-size: 18px;
    cursor: pointer;
    z-index: 200;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Notes Sidebar */
.notes-sidebar {
    width: 220px;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border-radius: 10px 0 0 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

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

.sidebar-header h3 {
    margin: 0;
    color: #000;
    font-weight: 500;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: #000;
    font-size: 18px;
    cursor: pointer;
}

.notes-list {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.note-item {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    color: #000;
    font-weight: 500;
    transition: background-color 0.2s;
}

.note-item:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #000;
}

.note-item.active {
    background-color: #000;
    color: white;
}

/* Content Area */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 350px);
    margin-right: 180px;
}

/* Toolbar Styles */
.toolbar {
    display: flex;
    justify-content: flex-start;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border-radius: 0 10px 0 0;
    overflow-x: auto;
    position: relative;
}

.tool-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tool-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 5px;
    border: none;
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--dark-color);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

/* Page Links in Toolbar */
.tool-btn.page-btn {
    background-color: var(--brown-color);
    width: auto;
    min-width: 90px;
    padding: 0 10px;
}

.tool-btn.page-btn a {
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 5px;
    text-decoration: none;
}

.tool-btn.page-btn span {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.tool-btn.page-btn:hover {
    background-color: #6d3610;
    transform: translateY(-2px);
}

/* Mobile-specific toolbar styles */
@media (max-width: 992px) {
    .toolbar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        padding: 8px;
    }
    
    .tool-buttons {
        flex-wrap: nowrap;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .content-area {
        margin-top: 60px; /* Increase this to make room for auth buttons */
    }
    
    .toolbar {
        padding: 8px 5px;
        margin-top: 10px;
    }
    
    .tool-buttons {
        gap: 8px;
    }
    
    .tool-btn.page-btn {
        min-width: 80px;
    }
}

@media (max-width: 576px) {
    .content-area {
        margin-top: 70px; /* Increase further for very small screens */
    }
    
    .auth-section {
        top: 5px;
        right: 5px;
    }
    
    .toolbar {
        padding: 6px 4px;
    }
    
    .tool-buttons {
        gap: 6px;
    }
    
    .tool-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 14px;
    }
    
    .tool-btn.page-btn {
        min-width: 70px;
        padding: 0 8px;
    }
    
    .tool-btn.page-btn span {
        font-size: 12px;
    }
}

/* Notepad Container */
.notepad-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    background-color: var(--paper-color);
    border-radius: 0 0 10px 10px;
    overflow: visible;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Note Header */
.note-header {
    background-color: var(--brown-color);
    padding: 15px 20px;
    color: white;
}

.note-header h3 {
    font-weight: 500;
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Welcome Message */
.welcome-message {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.welcome-message p {
    color: var(--dark-color);
    font-size: 16px;
}

/* Paper Styles */
.paper {
    flex: 1;
    display: flex;
    overflow: visible;
    background-color: var(--paper-color);
    background-image: 
        linear-gradient(to right, transparent 50px, var(--line-color) 50px, var(--line-color) 51px, transparent 51px),
        linear-gradient(var(--line-color) 1px, transparent 1px);
    background-size: 100% 100%, 100% 30px;
    background-position: 0 28px;
    position: relative;
    min-height: 400px;
    height: auto;
}

.paper::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50px;
    width: 1px;
    background-color: #FF9999;
    z-index: 1;
    height: 100%;
}

.paper-content {
    display: flex;
    flex: 1;
    padding: 0 0 0 70px;
    height: auto;
}

.paper-content textarea {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    line-height: 30px;
    padding: 0 30px 15px 0;
    margin-top: 8px;
    resize: vertical;
    min-height: 400px;
    height: auto;
    overflow: visible;
    outline: none;
}

/* Auth Section */
.auth-section {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.auth-buttons {
    display: flex;
    gap: 10px;
}

.auth-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.login-btn {
    background-color: #4CAF50;
    color: white;
}

.signup-btn {
    background-color: #2196F3;
    color: white;
}

.logout-btn {
    background-color: #f44336;
    color: white;
}

.save-btn {
    background-color: #4CAF50;
    color: white;
    margin-top: 10px;
    width: 100%;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.user-email {
    color: #333;
    font-weight: 500;
}

/* Mobile optimizations for auth section */
@media (max-width: 768px) {
    .auth-section {
        position: relative;
        top: 0;
        right: 0;
        width: 100%;
        padding: 10px;
        background-color: rgba(255, 255, 255, 0.95);
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        display: flex;
        justify-content: flex-end;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }

    .user-info {
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 10px;
        width: auto;
    }
    
    .auth-buttons {
        justify-content: flex-end;
    }
    
    .save-btn {
        margin-top: 0;
        margin-left: 10px;
    }

    .content-area {
        margin-top: 0;
    }
}

@media (max-width: 576px) {
    .auth-section {
        padding: 8px;
    }

    .user-info {
        gap: 5px;
        max-width: none;
    }
    
    .user-email {
        display: none;
    }
    
    .auth-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .logout-btn, .save-btn {
        margin: 0;
        width: auto;
    }
}

/* Registration Form */
.captcha-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 25px;
}

.captcha {
    height: 60px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
    font-size: 26px;
    letter-spacing: 8px;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.captcha::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 45%, rgba(0,0,0,0.1) 45%, rgba(0,0,0,0.1) 55%, transparent 55%);
    pointer-events: none;
}

.refresh-captcha {
    margin-top: 5px;
    align-self: flex-start;
    background-color: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.refresh-captcha:hover {
    text-decoration: underline;
}

.refresh-captcha i {
    font-size: 12px;
}

.terms-group {
    margin-bottom: 25px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
}

.checkbox-label a {
    color: var(--primary-color);
    text-decoration: none;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

.password-strength {
    height: 4px;
    background-color: #ddd;
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.password-strength::before {
    content: '';
    display: block;
    height: 100%;
    width: 0;
    background-color: #dc3545;
    transition: all 0.3s ease;
}

.password-strength.weak::before {
    width: 33%;
    background-color: #dc3545;
}

.password-strength.medium::before {
    width: 66%;
    background-color: #ffc107;
}

.password-strength.strong::before {
    width: 100%;
    background-color: #28a745;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: #2c5faa;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.modal-footer {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    text-align: center;
}

.modal-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.modal-footer a:hover {
    text-decoration: underline;
}

/* Responsive Styles for Modal */
@media (max-width: 576px) {
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        padding: 20px;
        width: 95%;
    }
    
    .form-control {
        padding: 10px;
        font-size: 15px;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 15px;
    }
    
    .captcha {
        height: 50px;
        font-size: 20px;
        letter-spacing: 5px;
    }
    
    .close-btn {
        top: 10px;
        right: 15px;
        font-size: 24px;
    }
    
    .modal h2 {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .modal p {
        font-size: 14px;
        margin-bottom: 20px;
    }
}

/* Error State Styling */
.form-control.error {
    border-color: var(--danger-color);
    background-color: rgba(220, 53, 69, 0.05);
}

.error-message {
    color: var(--danger-color);
    font-size: 13px;
    margin-top: 5px;
    display: none;
}

.error-message.visible {
    display: block;
}

/* Notes Grid */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.note-card {
    background-color: var(--paper-color);
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.note-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

.note-card-title {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-card-preview {
    font-size: 12px;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Dashboard Actions */
.dashboard-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

/* Alert Container */
.alert-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert {
    padding: 15px 20px;
    border-radius: 5px;
    background-color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    max-width: 300px;
    animation: slideIn 0.3s ease-out;
}

.alert-success {
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    border-left: 4px solid var(--danger-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive styles */
@media (max-width: 1200px) {
    .main-layout {
        max-width: 98%;
    }
    
    .content-area {
        max-width: calc(100% - 350px);
    }
}

@media (max-width: 992px) {
    .main-layout {
        height: auto;
        flex-direction: column;
        max-width: 98%;
    }
    
    .sidebar-toggle {
        display: block;
        position: fixed;
        top: 10px;
        left: 10px;
        width: 40px;
        height: 40px;
        border-radius: 5px;
        border: none;
        background-color: var(--brown-color);
        color: white;
        font-size: 18px;
        cursor: pointer;
        z-index: 1200;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
        transition: background-color 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }
    
    .sidebar-toggle:active {
        background-color: #6b3410;
    }
    
    .notes-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        z-index: 1150;
        border-radius: 0;
        transform: translateX(-100%);
        background-color: rgba(255, 255, 255, 0.95);
        box-shadow: none;
        will-change: transform;
    }
    
    .notes-sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    /* Add overlay when sidebar is active */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1100;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
    
    .content-area {
        width: 100%;
        max-width: 100%;
        border-radius: 0 0 10px 10px;
        margin-top: 0;
        margin-right: 0;
    }
    
    .toolbar {
        border-radius: 0;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 10px;
    }
    
    .paper {
        min-height: 400px;
        height: auto;
    }
}

@media (max-width: 768px) {
    .main-layout {
        padding: 10px;
    }
    
    .tool-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .notepad-container {
        border-radius: 0;
    }
    
    .paper-content {
        padding: 0 0 0 60px;
    }
    
    .paper-content textarea {
        padding: 0 15px 15px 0;
    }
}

@media (max-width: 576px) {
    .main-layout {
        max-width: 100%;
        padding: 5px;
    }
    
    .notes-sidebar {
        max-height: 150px;
    }
    
    .paper::before {
        left: 40px;
    }
    
    .paper-content {
        padding: 0 0 0 50px;
    }
    
    .auth-input, 
    .auth-btn,
    .form-control {
        padding: 10px;
        font-size: 14px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .modal-content {
        padding: 15px;
    }
    
    .user-email {
        font-size: 12px;
    }
    
    /* Adjust toolbar and auth buttons in mobile view */
    .toolbar {
        display: flex;
        flex-wrap: wrap;
        padding: 5px;
        margin-top: 0;
    }
    
    .tool-buttons {
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }
    
    .tool-btn {
        width: 35px;
        height: 35px;
        min-width: 35px;
        font-size: 14px;
    }
    
    /* Ensure the auth section doesn't overlap with sidebar toggle */
    .sidebar-toggle {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

/* Alert Styles */
.alert {
    padding: 12px 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    font-size: 14px;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
    padding: 30px;
}

.welcome-screen h1 {
    font-size: 36px;
    margin-bottom: 20px;
    color: var(--dark-color);
}

.welcome-screen p {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
    max-width: 600px;
    line-height: 1.6;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Icons */
.icon {
    width: 20px;
    height: 20px;
    display: inline-block;
}

/* Search Overlay */
.search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-image: url('../images/wood.png');
    background-size: cover;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.search-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0 20px;
    background-color: rgba(139, 69, 19, 0.5);
}

.search-input {
    width: 100%;
    max-width: 500px;
    height: 40px;
    padding: 0 15px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    font-size: 16px;
    background-color: rgba(255, 255, 255, 0.9);
    outline: none;
    color: #333;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(58, 123, 213, 0.3), inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Share Modal */
.share-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.share-link-container {
    display: flex;
    gap: 10px;
}

.share-link {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background-color: #f8f9fa;
    cursor: text;
}

.share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.share-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.share-btn:hover {
    transform: translateY(-2px);
}

.share-btn.facebook {
    background-color: #1877f2;
}

.share-btn.twitter {
    background-color: #1da1f2;
}

.share-btn.linkedin {
    background-color: #0077b5;
}

.share-btn.whatsapp {
    background-color: #25d366;
}

.share-settings {
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
}

#auth-modal {
    z-index: 2000; /* Ensure it's above other elements */
}

/* Page Links Container */
.page-links-container {
    display: none;
}

.page-links {
    display: flex;
    gap: 15px;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    padding: 8px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.page-link {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--dark-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.page-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.page-link i {
    font-size: 16px;
    color: var(--brown-color);
}

@media (max-width: 768px) {
    .page-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-link {
        font-size: 13px;
        padding: 5px 8px;
    }
} 