/* ===============================================
   ONLINE NOTES MANAGEMENT SYSTEM - STYLESHEET
   =============================================== */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #667eea;
    background-image: 
        linear-gradient(135deg, rgba(102, 126, 234, 0.9) 0%, rgba(118, 75, 162, 0.9) 100%),
        url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><defs><pattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse"><path d="M 20 0 L 0 0 0 20" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    background-size: cover, 100px 100px;
    background-position: center, 0 0;
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ============= HEADER ============= */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Cute 3D cloud title inside header */
.header .header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.header .cloud {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 60%);
    color: #333;
    padding: 10px 22px;
    border-radius: 40px;
    box-shadow: 0 18px 40px rgba(102, 102, 153, 0.18), inset 0 -6px 12px rgba(0,0,0,0.06);
    transform: translateY(8px);
}

.header .cloud::before,
.header .cloud::after {
    content: "";
    position: absolute;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 8px 18px rgba(102,102,153,0.12);
}

.header .cloud::before {
    width: 36px;
    height: 36px;
    left: -18px;
    top: 6px;
}

.header .cloud::after {
    width: 28px;
    height: 28px;
    right: -14px;
    top: 10px;
}

.header .cloud h1 {
    margin: 0;
    color: #333;
    font-size: 1.6rem;
    font-weight: 800;
    text-shadow: 0 6px 12px rgba(102,102,153,0.12);
}

.cloud-emoji {
    font-size: 1.6rem;
    transform: translateY(-2px);
}

/* Slight header caption styling */
.header p {
    margin: 0;
    color: rgba(255,255,255,0.9);
    font-weight: 300;
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .header .cloud h1 { font-size: 1.2rem; }
    .cloud-emoji { font-size: 1.2rem; }
    .header { padding: 20px; }
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 5px;
    font-weight: 700;
    letter-spacing: 1px;
}

.header p {
    font-size: 1em;
    opacity: 0.9;
    font-weight: 300;
}

/* ============= MAIN CONTENT ============= */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 20px;
    padding: 30px;
    flex: 1;
    overflow-y: auto;
}

/* ============= NOTES EDITOR ============= */
.notes-editor {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #e9ecef;
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.notes-editor h2 {
    color: #667eea;
    font-size: 1.5em;
    margin-bottom: 10px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #495057;
    font-size: 0.95em;
}

.form-group input[type="text"],
.form-group textarea {
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.95em;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: all 0.3s ease;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* ============= COLOR PALETTE ============= */
.color-palette {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.color-btn:hover {
    transform: scale(1.1);
    border-color: #667eea;
}

.color-btn.active {
    border-color: #667eea;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #667eea;
}

/* ============= BUTTONS ============= */
.button-group {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

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

.btn-secondary {
    background: #e9ecef;
    color: #495057;
}

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

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.85em;
    border-radius: 6px;
}

/* ============= STATUS MESSAGE ============= */
.status-message {
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    display: none;
}

.status-message.show {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* ============= NOTES DISPLAY ============= */
.notes-display {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-bar {
    display: flex;
    gap: 10px;
}

.search-bar input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.95em;
    transition: all 0.3s ease;
}

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

/* ============= FILTER CONTROLS ============= */
.filter-controls {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    color: #667eea;
}

.filter-btn:hover {
    border-color: #667eea;
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

/* ============= STATS ============= */
.stats {
    display: flex;
    gap: 20px;
    padding: 10px 0;
    font-size: 0.95em;
    color: #6c757d;
    font-weight: 600;
}

/* ============= NOTES GRID ============= */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 15px;
    flex: 1;
    overflow-y: auto;
    grid-auto-rows: 340px;
}

.no-notes {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    color: #adb5bd;
    font-size: 1.1em;
}

/* ============= NOTE CARD ============= */
.note-card {
    padding: 14px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: slideIn 0.3s ease;
    height: 100%;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.note-title {
    font-size: 1.05em;
    font-weight: 700;
    color: #333;
    word-wrap: break-word;
    line-height: 1.2;
}

.note-date {
    font-size: 0.70em;
    color: #888;
    white-space: nowrap;
}

.note-content {
    font-size: 0.82em;
    color: #555;
    line-height: 1.35;
    max-height: 120px;
    overflow-y: auto;
    word-wrap: break-word;
    flex: 1;
}

.note-actions {
    display: flex;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin-top: auto;
}

.note-btn {
    flex: 1;
    padding: 7px 5px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.75em;
    font-weight: 600;
    transition: all 0.2s ease;
}

.edit-btn {
    background: #667eea;
    color: white;
}

.edit-btn:hover {
    background: #5568d3;
}

.delete-btn {
    background: #dc3545;
    color: white;
}

.delete-btn:hover {
    background: #c82333;
}

/* ============= MODAL ============= */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 400px;
}

.modal-content p {
    font-size: 1.1em;
    margin-bottom: 20px;
    color: #333;
}

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

.modal-buttons .btn {
    flex: 1;
}

/* ============= TOAST NOTIFICATION ============= */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    background: #333;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 2000;
    animation: slideUp 0.3s ease;
}

.toast.show {
    display: block;
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

.toast.info {
    background: #17a2b8;
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============= RESPONSIVE DESIGN ============= */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .notes-editor {
        position: relative;
        top: auto;
    }

    .notes-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    /* On small screens allow cards to size to their content for better flow */
    .notes-grid {
        grid-auto-rows: auto;
    }
}

@media (max-width: 768px) {
    .container {
        height: auto;
        border-radius: 0;
    }

    .header {
        padding: 20px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .main-content {
        padding: 15px;
    }

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

    .filter-controls {
        flex-wrap: wrap;
    }

    .color-palette {
        gap: 8px;
    }

    .color-btn {
        width: 35px;
        height: 35px;
    }
}

/* ============= SCROLLBAR STYLING ============= */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}
