/* Import Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* Gaya Umum */
body {
    font-family: 'Poppins', sans-serif;
    background-color: #f0f4f8; /* Latar belakang abu-abu terang */
    color: #333;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

/* Dark Mode */
body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}
body.dark-mode .main-container,
body.dark-mode .container,
body.dark-mode .note-card,
body.dark-mode .modal-content,
body.dark-mode .stats-container,
body.dark-mode .stat-card {
    background-color: #1e1e1e;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
    color: #00e6e6;
}
body.dark-mode input[type="text"],
body.dark-mode input[type="password"],
body.dark-mode input[type="email"],
body.dark-mode textarea,
body.dark-mode #searchInput,
body.dark-mode #sortSelect {
    background-color: #333;
    border-color: #555;
    color: #e0e0e0;
}
body.dark-mode input:focus,
body.dark-mode textarea:focus,
body.dark-mode #searchInput:focus {
    border-color: #00e6e6;
    box-shadow: 0 0 0 3px rgba(0, 230, 230, 0.2);
}
body.dark-mode .toggle-password {
    color: #aaa;
}
body.dark-mode .note-card {
    border-left-color: #00e6e6;
}
body.dark-mode .note-card h3 {
    color: #00e6e6;
}
body.dark-mode .note-card p {
    color: #ccc;
}
body.dark-mode .note-actions a {
    background-color: #555;
}
body.dark-mode .pagination-nav a,
body.dark-mode .pagination-nav span {
    background-color: #333;
    border-color: #555;
    color: #ccc;
}
body.dark-mode .pagination-nav a.active {
    background-color: #00e6e6;
    border-color: #00e6e6;
    color: #1e1e1e;
}
body.dark-mode .page-info {
    color: #ccc;
}
body.dark-mode .toggle-link {
    color: #00e6e6;
}
body.dark-mode .btn {
    background-color: #333;
    color: #eee;
}

/* Container untuk landing page & form */
.main-container {
    display: flex;
    width: 90%;
    max-width: 1200px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Landing Page Section */
.landing-page {
    flex: 1.5;
    padding: 3rem;
    background-color: #008080; /* Warna Teal */
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.landing-page h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
    font-weight: 600;
}

.landing-page p {
    font-size: 1.1rem;
    line-height: 1.6;
    opacity: 0.9;
}

/* Emotikon Ilustrasi */
.landing-page .illustration-emoticon {
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 100px;
    opacity: 0.5;
    transform: rotate(-15deg);
    z-index: 0;
}

/* Form Section */
.form-container {
    flex: 1;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

h2 {
    color: #008080;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

input[type="text"],
input[type="password"],
input[type="email"],
textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 16px;
    background-color: #f9fafc;
    transition: all 0.3s ease;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #008080;
    box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.2);
}

button {
    background-color: #008080;
    color: white;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s;
}

button:hover {
    background-color: #006666;
    transform: translateY(-2px);
}

.password-container {
    position: relative;
}

.password-container input {
    padding-right: 40px;
}

.password-container .toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #888;
}

.g-recaptcha {
    margin-bottom: 15px;
}

.toggle-link {
    cursor: pointer;
    color: #008080;
    text-decoration: none;
    margin-top: 15px;
    display: block;
    font-weight: 500;
    transition: color 0.3s ease;
}

.toggle-link:hover {
    color: #006666;
    text-decoration: underline;
}

/* Dashboard */
.dashboard-container {
    padding: 20px;
    max-width: 1200px;
    margin: auto;
}

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

.header h1 {
    color: #008080;
    font-weight: 600;
    margin: 0;
}

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

.note-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Transisi halus saat memuat catatan */
#notes-container {
    opacity: 1; /* Default: terlihat */
    transition: opacity 0.5s ease; /* Transisi halus selama 0.5 detik */
}

.note-card {
    background-color: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    position: relative;
    border-left: 5px solid #008080;
    cursor: pointer;
}

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

.note-card .serial-number {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #ccc;
}

.note-card h3 {
    color: #008080;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.25rem;
    font-weight: 600;
}

.note-card p {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-tags {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag-item {
    background-color: #e0e0e0;
    color: #555;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
}

.note-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.note-actions a {
    text-decoration: none;
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.note-actions .edit {
    background-color: #2196F3;
}

.note-actions .delete {
    background-color: #f44336;
}
.note-actions .archive {
    background-color: #ffc107;
}

.add-note-btn {
    padding: 12px 25px;
    background-color: #008080;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.add-note-btn:hover {
    background-color: #006666;
}

.logout-btn {
    background-color: #999;
    color: white;
    text-decoration: none;
    padding: 12px 25px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background-color: #666;
}

.profile-btn {
    background-color: #3498db;
    color: white;
    text-decoration: none;
    padding: 12px 25px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.profile-btn:hover {
    background-color: #2980b9;
}

.view-archive-btn {
    background-color: #1abc9c;
    color: white;
    text-decoration: none;
    padding: 12px 25px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.view-archive-btn:hover {
    background-color: #16a085;
}

/* Halaman Tambah/Edit/Hapus */
.container {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
    margin: 50px auto;
    text-align: center;
}

.container h1 {
    color: #008080;
    font-weight: 600;
}

/* Pencarian & Sortir */
.controls-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.search-container {
    flex: 1;
}

.sort-container {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

#searchInput {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    border: 1px solid #e0e6ed;
    border-radius: 25px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

#sortSelect {
    padding: 12px 20px;
    font-size: 16px;
    border: 1px solid #e0e6ed;
    border-radius: 25px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666666'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
}


#searchInput:focus, #sortSelect:focus {
    outline: none;
    border-color: #008080;
    box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.2);
}

/* Paginasi */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-nav {
    display: flex;
    gap: 5px;
}

.pagination-nav a,
.pagination-nav span {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #555;
    background-color: #fff;
    border: 1px solid #e0e6ed;
    transition: all 0.3s ease;
}

.pagination-nav a:hover:not(.active) {
    background-color: #f0f4f8;
    color: #008080;
}

.pagination-nav a.active {
    background-color: #008080;
    color: white;
    border-color: #008080;
    font-weight: 600;
}

.pagination-nav a.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.page-info {
    color: #666;
    font-size: 14px;
}

/* Pesan Kosong atau Error */
.loading-message, .no-notes-message, .error-message {
    text-align: center;
    font-size: 1.1rem;
    color: #888;
    margin-top: 50px;
    width: 100%;
}

/* Tombol Dark Mode */
.btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 24px;
    padding: 0;
    color: inherit;
}

/* Card Statistik */
.stats-container {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.stat-card {
    background-color: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    flex: 1;
    min-width: 150px;
    text-align: center;
}

.stat-card h3 {
    color: #008080;
    font-weight: 600;
    margin: 0;
    font-size: 1rem;
}

.stat-card p {
    font-size: 2.5rem;
    font-weight: 700;
    color: #555;
    margin: 10px 0 0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 12px;
    position: relative;
    animation: fadeIn 0.5s;
}

.modal-content h2 {
    color: #008080;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-top: 0;
}

.modal-content p {
    white-space: pre-wrap;
    line-height: 1.6;
    font-size: 1rem;
}

.modal .close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    text-decoration: none;
}

.modal .close-btn:hover,
.modal .close-btn:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-actions a,
.modal-actions button {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
}
/* Perbaikan CSS tombol Edit pada Modal */
.modal-actions .modal-edit-btn {
    background-color: #3498db;
    color: white;
    font-weight: 500;
}
.modal-actions .modal-edit-btn:hover {
    background-color: #2980b9;
}
/* Perbaikan CSS tombol Hapus pada Modal */
.modal-actions .modal-delete-btn {
    background-color: #f44336;
    color: white;
    font-weight: 500;
}
.modal-actions .modal-delete-btn:hover {
    background-color: #e74c3c;
}

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

/* Profil */
.container.profile-container {
    max-width: 600px;
    text-align: left;
}
.container.profile-container h1, .container.profile-container h2 {
    text-align: center;
}

.container.profile-container hr {
    margin: 30px 0;
    border: 0;
    border-top: 1px solid #eee;
}

.form-group {
    text-align: left;
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.container.profile-container input[type="text"],
.container.profile-container input[type="password"],
.container.profile-container input[type="email"] {
    width: 100%;
}


/* Responsive */
@media (max-width: 992px) {
    .main-container {
        flex-direction: column;
        width: 100%;
        height: auto;
    }
    .landing-page {
        padding: 2rem;
        text-align: center;
        align-items: center;
    }
    .form-container {
        padding: 2rem;
    }
    .landing-page .illustration-emoticon {
        bottom: auto;
        top: 20px;
        right: 20px;
        font-size: 60px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }
    .note-grid {
        grid-template-columns: 1fr;
    }
    .header {
        flex-direction: column;
        align-items: flex-start;
    }
    .controls-container {
        flex-direction: column;
        align-items: center;
    }
    .pagination-container {
        flex-direction: column;
        align-items: center;
    }
    .pagination-nav {
        margin-top: 15px;
    }
    .stats-container {
        flex-direction: column;
    }
}
/* --- Perbaikan untuk Quill Rich Text Editor --- */
.ql-toolbar.ql-snow {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-color: #e0e6ed;
    background-color: #f9fafc;
    border-bottom: none;
    font-size: 14px;
    padding: 12px;
}

body.dark-mode .ql-toolbar.ql-snow {
    background-color: #333;
    border-color: #555;
}

.ql-container.ql-snow {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    border-color: #e0e6ed;
    font-size: 16px;
    background-color: #f9fafc;
    transition: all 0.3s ease;
}

body.dark-mode .ql-container.ql-snow {
    background-color: #333;
    border-color: #555;
    color: #e0e0e0;
}

/* Hapus fokus default Quill agar tidak tumpang tindih */
.ql-container:focus,
.ql-editor:focus {
    border-color: #e0e6ed;
    box-shadow: none;
}

/* Tambahkan efek fokus yang serasi */
.ql-container:focus-within,
.ql-container.ql-editor:focus-within {
    border-color: #008080;
    box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.2);
}

body.dark-mode .ql-container:focus-within {
    border-color: #00e6e6;
    box-shadow: 0 0 0 3px rgba(0, 230, 230, 0.2);
}

/* Perbaikan gaya tombol dan dropdown Quill */
.ql-snow .ql-stroke {
    fill: none;
    stroke: #666;
    transition: stroke 0.3s;
}

body.dark-mode .ql-snow .ql-stroke {
    stroke: #ccc;
}

.ql-snow .ql-picker-label {
    color: #666;
}

body.dark-mode .ql-snow .ql-picker-label {
    color: #ccc;
}

/* --- Perbaikan untuk Input Tag Otomatis --- */
.tag-input-container {
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background-color: #f9fafc;
    align-items: center;
    min-height: 50px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

body.dark-mode .tag-input-container {
    background-color: #333;
    border-color: #555;
}

.tag-input-container:focus-within {
    border-color: #008080;
    box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.2);
}

body.dark-mode .tag-input-container:focus-within {
    border-color: #00e6e6;
    box-shadow: 0 0 0 3px rgba(0, 230, 230, 0.2);
}

#note_tags {
    flex-grow: 1;
    border: none;
    padding: 0;
    font-size: 16px;
    background-color: transparent;
    outline: none;
}

.tag-pill {
    display: flex;
    align-items: center;
    background-color: #008080;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    gap: 8px;
}

body.dark-mode .tag-pill {
    background-color: #00e6e6;
    color: #1e1e1e;
}

.tag-pill .remove-tag {
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
}