/* --- VIEW TOGGLE & NOTES --- */
.view-toggle-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 0 10px;
}

.toggle-btn {
    background: transparent;
    border: 2px solid #e5e7eb;
    color: #6b7280;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-btn:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.toggle-btn.active {
    background-color: #2563eb;
    border-color: #2563eb;
    color: white;
    box-shadow: 0 2px 5px rgba(37, 99, 235, 0.3);
}

/* --- NOTES GRID SYSTEM --- */

#notesContainer {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
    min-height: 80vh;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    width: 100%;
}

@media (max-width: 768px) {
    .notes-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 Columns on mobile */
    }
}

/* Note Card (Thumbnail) */
.note-card {
    background-color: #fffbeb;
    /* Default yellow */
    border-radius: 12px;
    padding: 15px;
    height: 150px;
    /* Fixed height for thumbnails */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.note-card:active {
    transform: scale(0.98);
}

.note-card h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-card p {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* Colors for cards */
.note-card[data-color="yellow"] {
    background-color: #fffbeb;
}

.note-card[data-color="blue"] {
    background-color: #e0f2fe;
}

.note-card[data-color="green"] {
    background-color: #dcfce7;
}

.note-card[data-color="pink"] {
    background-color: #fce7f3;
}

.note-card[data-color="purple"] {
    background-color: #f3e8ff;
}

/* Floating Action Button */
.fab-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #2563eb;
    /* Primary blue */
    color: white;
    font-size: 24px;
    border: none;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s;
}

.fab-btn:hover {
    transform: scale(1.1);
}

/* Modal Editor */
.note-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    /* Dimmed background */
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.note-modal-content {
    background-color: #fffbeb;
    /* Default matching note color logic via JS */
    width: 100%;
    height: 100%;
    max-width: 600px;
    max-height: 100%;
    /* Fullscreen on mobile often better */
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
    transition: background-color 0.3s;
}

/* Desktop: Modal feel */
@media (min-width: 768px) {
    .note-modal-content {
        height: 80vh;
        border-radius: 16px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    }
}

.note-toolbar {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #555;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.icon-btn.danger {
    color: #ef4444;
}

.spacer {
    flex: 1;
}

.save-status {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}

.save-status::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background-color: #10b981;
    /* Green dot */
    border-radius: 50%;
}

.note-title-input {
    background: transparent;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: #1f2937;
    width: 100%;
    margin-bottom: 15px;
    outline: none;
}

.note-title-input::placeholder {
    color: rgba(31, 41, 55, 0.4);
}

.note-content-area {
    flex: 1;
    background: transparent;
    border: none;
    resize: none;
    font-size: 18px;
    line-height: 1.6;
    color: #374151;
    outline: none;
    font-family: inherit;
}

.note-footer-colors {
    display: flex;
    gap: 10px;
    padding-top: 15px;
    overflow-x: auto;
}

.color-opt {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.color-opt:hover {
    transform: scale(1.1);
    border-color: rgba(0, 0, 0, 0.3);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.note-modal {
    animation: fadeIn 0.2s ease-out;
}

/* SweetAlert Z-Index Fix */
div:where(.swal2-container) {
    z-index: 3000 !important;
}

.hidden-force {
    display: none !important;
}
/* --- ADMIN PANEL INLINE STYLES --- */
.admin-panel-inline {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.admin-header-inline {
    text-align: center;
    margin-bottom: 20px;
}

.admin-header-inline h2 {
    font-size: 22px;
    color: #1f2937;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.admin-action-area {
    margin-bottom: 20px;
}

.search-wrapper-admin {
    position: relative;
    margin-bottom: 15px;
}

#searchUserInline {
    width: 100%;
    padding: 14px 20px 14px 45px;
    border: none;
    background-color: #f3f4f6;
    border-radius: 12px;
    font-size: 15px;
    color: #374151;
    box-sizing: border-box;
    outline: none;
}

#searchUserInline:focus {
    background-color: white;
    box-shadow: 0 0 0 2px #d1fae5;
}

.search-icon-admin {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 16px;
}

#addUserBtnInline {
    width: 100%;
    background-color: #10b981;
    color: white;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.user-card-inline {
    background: white;
    padding: 14px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

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

.user-avatar-inline {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: white;
}

.bg-indigo { background-color: #6366f1; }
.bg-pink { background-color: #ec4899; }
.bg-orange { background-color: #f59e0b; }
.bg-teal { background-color: #14b8a6; }

.user-details-inline h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.role-badge-inline {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 3px;
}

.role-admin-inline {
    background-color: #d1fae5;
    color: #065f46;
}

.role-user-inline {
    background-color: #dbeafe;
    color: #1e40af;
}

.card-actions-inline {
    display: flex;
    gap: 6px;
}

.btn-icon-inline {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #9ca3af;
    padding: 6px;
    border-radius: 6px;
}

.btn-icon-inline.edit:hover {
    background-color: #eef2ff;
    color: #6366f1;
}

.btn-icon-inline.delete:hover {
    background-color: #fef2f2;
    color: #ef4444;
}

.footer-count-inline {
    text-align: center;
    color: #9ca3af;
    margin-top: 25px;
    font-size: 13px;
}

/* --- SWEETALERT2 RESPONSIVE & MODERN STYLES --- */
.swal2-popup {
    width: 90% !important;
    max-width: 400px !important;
    padding: 20px !important;
    border-radius: 20px !important;
}

.swal2-input, .swal2-textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 8px 0 !important;
    padding: 14px 16px !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 12px !important;
    font-size: 15px !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}

.swal2-input:focus, .swal2-textarea:focus {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
    outline: none !important;
}

.swal2-select {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 8px 0 !important;
    padding: 14px 16px !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 12px !important;
    font-size: 15px !important;
    background-color: #f9fafb !important;
    color: #374151 !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px !important;
    padding-right: 40px !important;
}

.swal2-select:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
    outline: none !important;
}

.swal2-select:hover {
    background-color: #f3f4f6 !important;
}

.swal2-html-container {
    padding: 0 10px !important;
    margin: 15px 0 !important;
}

@media (max-width: 480px) {
    .swal2-popup {
        width: 95% !important;
        padding: 16px !important;
    }
    
    .swal2-title {
        font-size: 20px !important;
    }
    
    .swal2-input, .swal2-textarea, .swal2-select {
        padding: 12px 14px !important;
        font-size: 14px !important;
    }
    
    .swal2-actions {
        gap: 10px !important;
    }
    
    .swal2-confirm, .swal2-cancel {
        padding: 12px 24px !important;
        font-size: 14px !important;
    }
}

/* --- TASK EDIT MODAL STYLES --- */
.edit-task-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
}

.edit-task-form-row > * {
    flex: 1 1 120px;
    min-width: 0;
    margin: 0 !important;
}

/* Ajuste de padding para que el texto no se corte en selects pequeños */
.swal2-select {
    padding: 10px 30px 10px 12px !important;
    font-size: 14px !important;
    background-position: right 8px center !important;
}

.swal2-input {
    padding: 10px 12px !important;
    font-size: 14px !important;
}

/* --- MODERN INPUT HEADER STYLES --- */
.input-row input {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 15px;
    transition: all 0.2s ease;
    background-color: #f9fafb;
    outline: none;
}

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

.button-row select {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    background-color: #fff;
    cursor: pointer;
    outline: none;
    height: 44px; /* Align height with buttons */
    transition: all 0.2s;
}

.button-row select:focus {
    border-color: #2563eb;
}

/* Ensure Task Input takes available space nicely */
#taskInput {
    flex: 2;
}

#taskDate {
    flex: 1;
    cursor: pointer;
}

/* Button Updates for Height Alignment */
.button-row button {
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
