* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #4a5568;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    height: calc(100vh - 40px);
}

.main-section {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

h1 {
    color: #667eea;
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 300;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-icon {
    width: 32px;
    height: 32px;
    color: #667eea;
}

h3 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon {
    width: 20px;
    height: 20px;
}

.date-display {
    color: #a0aec0;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.entries-container {
    overflow-y: auto;
    margin-top: 30px;
}

.entry {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
}

.entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.entry-time {
    color: #a0aec0;
    font-size: 0.85rem;
}

.entry-actions {
    display: flex;
    gap: 10px;
}

.entry-actions button {
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.entry-actions button:hover {
    color: #667eea;
}

.entry-content {
    color: #4a5568;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.entry-tags {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.tag-editable {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tag-remove {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    padding: 0;
    font-size: 1.2rem;
    line-height: 1;
    font-weight: bold;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.tag-remove:hover {
    opacity: 1;
}

.tag-suggestion {
    cursor: pointer;
    background: rgba(102, 126, 234, 0.05);
    transition: all 0.2s;
}

.tag-suggestion:hover {
    background: rgba(102, 126, 234, 0.15);
    transform: scale(1.05);
}

.tag-input-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
}

.tag-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.current-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.tag-input {
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.8rem;
    outline: none;
    min-width: 100px;
    flex: 0 0 auto;
}

.tag-input:focus {
    border-color: rgba(102, 126, 234, 0.5);
}

.tag-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.tag-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 4px;
    min-width: 200px;
}


.tag-autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

.tag-autocomplete-item:last-child {
    border-bottom: none;
}

.tag-autocomplete-item:hover,
.tag-autocomplete-item:focus {
    background: rgba(102, 126, 234, 0.1);
    outline: none;
}

.current-tags {
    position: relative;
}


.editor-container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.formatting-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

.formatting-toolbar button {
    background: rgba(102, 126, 234, 0.1);
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: #667eea;
    font-weight: 600;
    transition: all 0.3s;
}

.formatting-toolbar button:hover {
    background: rgba(102, 126, 234, 0.2);
}

.editor {
    width: 100%;
    min-height: 120px;
    border: none;
    outline: none;
    font-size: 1rem;
    color: #4a5568;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
}

.add-entry-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    margin-bottom: 20px;
}

.add-entry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.tags-panel {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.tags-panel h3 {
    color: #667eea;
    font-size: 1rem;
    margin-bottom: 15px;
    font-weight: 500;
}

.tags-collection {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    background: white;
    color: #667eea;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(102, 126, 234, 0.3);
    cursor: pointer;
    transition: all 0.3s;
}

.tag-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.05);
}

.ai-chat-panel {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    max-height: 400px;
}

.ai-chat-panel h3 {
    color: #667eea;
    font-size: 1rem;
    margin-bottom: 15px;
    font-weight: 500;
}

.suggested-prompts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.prompt-btn {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    color: #667eea;
    font-size: 0.85rem;
    text-align: left;
    transition: all 0.3s;
}

.prompt-btn:hover {
    background: rgba(102, 126, 234, 0.2);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    padding: 10px 15px;
    border-radius: 12px;
    max-width: 90%;
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-message.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
}

.chat-message.ai {
    background: rgba(102, 126, 234, 0.1);
    color: #4a5568;
    align-self: flex-start;
}

.chat-input-container {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 20px;
    outline: none;
    font-size: 0.9rem;
}

.chat-send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.chat-send-btn:hover {
    transform: scale(1.05);
}

.calendar-panel {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.calendar-panel h3 {
    color: #667eea;
    font-size: 1rem;
    margin-bottom: 15px;
    font-weight: 500;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-nav {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px 10px;
}

.calendar-month {
    color: #4a5568;
    font-weight: 600;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day-label {
    text-align: center;
    font-size: 0.75rem;
    color: #a0aec0;
    padding: 5px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    color: #4a5568;
}

.calendar-day:hover {
    background: rgba(102, 126, 234, 0.1);
}

.calendar-day.has-entry {
    background: rgba(102, 126, 234, 0.2);
    font-weight: 600;
    color: #667eea;
}

.calendar-day.today {
    border: 2px solid #667eea;
}

.calendar-day.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.calendar-day.other-month {
    color: #cbd5e0;
}

.status-indicator {
    font-size: 0.8rem;
    color: #a0aec0;
    margin-top: 10px;
    font-style: italic;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(102, 126, 234, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .main-section {
        height: auto;
        min-height: 60vh;
    }

    .sidebar {
        order: 2;
    }

    .entries-container {
        max-height: 50vh;
    }

    .ai-chat-panel {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        gap: 15px;
    }

    .main-section {
        padding: 20px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .editor-container {
        padding: 15px;
    }

    .editor {
        min-height: 100px;
        font-size: 0.95rem;
    }

    .tags-panel, .ai-chat-panel, .calendar-panel {
        padding: 15px;
    }

    .formatting-toolbar {
        flex-wrap: wrap;
    }
}

/* Authentication Styles */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-box {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    max-width: 450px;
    width: 100%;
}

.auth-box h1 {
    text-align: center;
    margin-bottom: 10px;
}

.auth-subtitle {
    text-align: center;
    color: #a0aec0;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.auth-form {
    margin-top: 20px;
}

.auth-form h2 {
    color: #4a5568;
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 400;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #4a5568;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.auth-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.auth-toggle {
    text-align: center;
    margin-top: 20px;
    color: #a0aec0;
    font-size: 0.9rem;
}

.auth-toggle a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.auth-toggle a:hover {
    text-decoration: underline;
}

.auth-error {
    display: none;
    background: #fed7d7;
    color: #c53030;
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    border: 1px solid #fc8181;
}

.auth-message {
    display: none;
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.auth-message.success {
    background: #c6f6d5;
    color: #2f855a;
    border: 1px solid #9ae6b4;
}

.auth-message.info {
    background: #bee3f8;
    color: #2c5282;
    border: 1px solid #90cdf4;
}

/* App Header Styles */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-email {
    color: #667eea;
    font-size: 0.9rem;
    font-weight: 500;
}

.logout-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.4);
}

/* Responsive adjustments for auth */
@media (max-width: 768px) {
    .auth-box {
        padding: 30px 20px;
    }
    
    .app-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f7fafc 100%);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-title {
    color: #2d3748;
    font-size: 1.5rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.modal-message {
    color: #4a5568;
    font-size: 1rem;
    margin-bottom: 25px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn-cancel {
    background: #e2e8f0;
    color: #4a5568;
}

.modal-btn-cancel:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

.modal-btn-confirm {
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
    color: white;
}

.modal-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.4);
}

/* Upgrade Button */
.upgrade-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Cancel Edit Button */
.cancel-edit-btn {
    padding: 15px 30px;
    background: linear-gradient(135deg, #a0aec0 0%, #718096 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.cancel-edit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(113, 128, 150, 0.4);
}
