body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.card-title {
    font-weight: bold;
}

#mic-btn {
    cursor: pointer;
}

.input-error {
    border: 1px solid red;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

#notes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.note {
    background: #fffacd;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    position: relative;
    transition: box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
    max-height: 200px;
    height: 200px;
    overflow: hidden;
    width: 100%;
    max-width: 350px;
}

.note:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.note-content {
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    line-clamp: 5;
    -webkit-box-orient: vertical;
    max-height: 90px;
    min-height: 40px;
    white-space: normal;
}

.note-timestamp {
    font-size: 0.7em; /* Reduced font size */
    color: #6c757d;
    margin-right: auto; /* Pushes the timestamp to the left */
    white-space: nowrap; /* Prevent text wrapping */
    min-width: max-content; /* Better cross-browser support for minimum necessary width */
}

.note-footer {
    display: flex;
    justify-content: space-between; /* Aligns timestamp to left, buttons to right */
    align-items: center;
    padding-top: 5px; /* Reduced padding */
    border-top: 1px solid #eee;
    margin-top: auto; /* Pushes the footer to the bottom */
}

.note-buttons {
    display: flex;
    flex-wrap: wrap;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 4px;
    padding: 1px 4px;
    box-shadow: 0 0 5px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    position: absolute;
    z-index: 10;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    min-width: 95%;
    justify-content: center;
}

.note-footer {
    position: relative;
}

.note:hover .note-buttons {
    opacity: 1;
    visibility: visible;
    background-color: #fffbe5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.13);
}


.note:hover .note-buttons {
    opacity: 1; /* Show on hover */
    visibility: visible; /* Show on hover */
}

.note-buttons button {
    background: none;
    border: none;
    color: #333;
    cursor: pointer;
    font-size: 1em; /* Reduced font size */
    margin-left: 3px; /* Reduced margin */
}

.note-buttons button:hover {
    color: #007bff;
}

/* Modal for full note view */
.note-modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}
.note-modal.active {
    display: flex;
}
.note-modal-content {
    background: #fff;
    border-radius: 10px;
    max-width: 500px;
    width: 90vw;
    max-height: 80vh;
    padding: 24px 20px 12px 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    position: relative;
}
.note-modal-title {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 8px;
}
.note-modal-timestamp {
    font-size: 0.9em;
    color: #888;
    margin-bottom: 12px;
}
.note-modal-body {
    overflow-y: auto;
    flex: 1 1 auto;
    margin-bottom: 12px;
    white-space: pre-wrap;
}
.note-modal-close {
    position: absolute;
    top: 10px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5em;
    color: #888;
    cursor: pointer;
}

/* Media query for small screens */
@media (max-width: 576px) {
    .button-text {
        display: none;
    }
    .btn {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    .note-modal-content {
        max-width: 98vw;
        padding: 12px 4px 8px 4px;
    }
}

/* Utility classes */
.hidden {
    display: none;
}
