/* ====== Reset & Base Styles ====== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ====== Header ====== */
.header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo i {
    font-size: 1.8rem;
}

.logo small {
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0.9;
}

.nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

/* ====== Main Content ====== */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* ====== Editor Section ====== */
.editor-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
    overflow: hidden;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 1rem;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.stats {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ====== Buttons ====== */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

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

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

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
}

.btn-secondary {
    background: #64748b;
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-large {
    padding: 0.8rem 2rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ====== Editor Body ====== */
.editor-body {
    padding: 2rem;
}

.note-title {
    width: 100%;
    font-size: 1.5rem;
    font-weight: 600;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.note-title:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.note-content {
    width: 100%;
    min-height: 400px;
    font-size: 1rem;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
    line-height: 1.8;
}

.note-content:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ====== Editor Footer ====== */
.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: #f8fafc;
    border-top: 2px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-left {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.footer-right {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label small {
    color: #64748b;
    font-size: 0.85rem;
}

.auto-save-status {
    color: #10b981;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ====== Saved Notes Section ====== */
.saved-notes-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    font-size: 1.5rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sort-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
}

.sort-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.sort-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

/* ====== Notes List ====== */
.notes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.note-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.note-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-2px);
}

.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.note-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    word-break: break-word;
}

.note-card-actions {
    display: flex;
    gap: 0.5rem;
}

.note-action-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.note-action-btn:hover {
    color: #2563eb;
}

.note-action-btn.delete:hover {
    color: #dc2626;
}

.note-card-preview {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.5;
}

.note-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 1rem;
}

.note-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.note-badge.public {
    background: #dbeafe;
    color: #1e40af;
}

.note-badge.private {
    background: #fee2e2;
    color: #991b1b;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #94a3b8;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state p {
    font-size: 1.1rem;
}

/* ====== Footer ====== */
.footer {
    background: #1e293b;
    color: white;
    padding: 2rem 0 1rem;
    margin-top: auto;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.footer-description {
    text-align: center;
}

.footer-description p {
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.8;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.footer-links a:hover {
    color: #2563eb;
}

.footer-copyright {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid #334155;
}

.footer-copyright p {
    color: #94a3b8;
    font-size: 0.9rem;
}

/* ====== Modal ====== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.modal-header h3 {
    font-size: 1.3rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    color: #dc2626;
}

.modal-body {
    padding: 1.5rem;
}

/* ====== Share Modal Specific ====== */
.share-link-container {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.share-link-input {
    flex: 1;
    padding: 0.8rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: monospace;
}

.share-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* ====== Login Form ====== */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #1e293b;
}

.form-input {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ====== Toast Notification ====== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #10b981;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: none;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    z-index: 1001;
    animation: toastSlideIn 0.3s ease;
}

.toast.active {
    display: flex;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ====== Responsive Design ====== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .logo {
        flex-direction: column;
    }

    .nav {
        width: 100%;
        justify-content: center;
    }

    .editor-header {
        flex-direction: column;
        align-items: stretch;
    }

    .button-group {
        width: 100%;
    }

    .button-group .btn {
        flex: 1;
        justify-content: center;
    }

    .stats {
        text-align: center;
    }

    .editor-body {
        padding: 1rem;
    }

    .note-title {
        font-size: 1.2rem;
    }

    .note-content {
        min-height: 300px;
    }

    .editor-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .footer-left {
        flex-direction: column;
        width: 100%;
    }

    .footer-left .btn {
        width: 100%;
        justify-content: center;
    }

    .notes-list {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .sort-controls {
        width: 100%;
    }

    .sort-btn {
        flex: 1;
        justify-content: center;
    }

    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .logo span {
        font-size: 1.2rem;
    }

    .logo small {
        font-size: 0.8rem;
    }

    .section-header h2 {
        font-size: 1.2rem;
    }

    .share-link-container {
        flex-direction: column;
    }

    .share-options {
        flex-direction: column;
    }

    .share-options .btn {
        width: 100%;
        justify-content: center;
    }
}