/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

/* Theme-specific styles */
[data-theme="dark"] {
    background: linear-gradient(to bottom right, #0A0A0B, #1F2937);
    color: #F3F4F6;
}

[data-theme="light"] {
    background: linear-gradient(to bottom right, #FFFFFF, #F9FAFB);
    color: #111827;
}

/* Animations */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(1rem); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pop {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.animate-fade-in {
    animation: fade-in 0.4s ease-in;
}

.animate-pop {
    animation: pop 0.3s ease forwards;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

#themeToggle {
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

[data-theme="dark"] #themeToggle:hover {
    background: rgba(55, 65, 81, 0.5);
}

[data-theme="dark"] #themeToggle {
    color: rgba(255, 255, 255, 0.5);
}

[data-theme="light"] #themeToggle:hover {
    background: rgba(209, 213, 219, 0.5);
}

.icon {
    width: 24px;
    height: 24px;
}

/* Info Box */
.card {
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid #374151;
    border-radius: 0.75rem;
    padding: 1.5rem;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
}

.info-box {
    position: relative;
}

.info-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.info-box h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

.info-box p{margin-bottom:1rem;}

#infoBoxCloseBtn {
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #9CA3AF;
    transition: color 0.3s ease;
}

[data-theme="light"] #infoBoxCloseBtn {
    color: #6B7280;
}

[data-theme="dark"] #infoBoxCloseBtn:hover {
    color: #F3F4F6;
}

[data-theme="light"] #infoBoxCloseBtn:hover {
    color: #374151;
}

.info-box p {
    font-size: 1.125rem;
    color: #E5E7EB;
}

[data-theme="light"] .info-box p {
    color: #374151;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid #374151;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 640px) {
    .controls {
        flex-direction: row;
    }
}

#searchInput {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #4B5563;
    background: rgba(17, 24, 39, 0.5);
    color: #F3F4F6;
    font-size: 1.125rem;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="light"] #searchInput {
    background: #F9FAFB;
    border: 1px solid #D1D5DB;
    color: #111827;
}

#searchInput:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 2px #2563EB;
}

@media (min-width: 640px) {
    #searchInput {
        width: 20rem;
    }
}

.controls-left{
    display: flex;
    gap: 2rem;
}
.controls-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

@media (min-width: 640px) {
    .controls-right {
        width: auto;
    }
}

.sort-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-group label {
    font-size: 1.125rem;
    font-weight: 500;
    color: #E5E7EB;
}

[data-theme="light"] .sort-group label {
    color: #374151;
}

#sort {
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid #4B5563;
    background: rgba(17, 24, 39, 0.5);
    color: #F3F4F6;
    font-size: 1.125rem;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="light"] #sort {
    background: #F9FAFB;
    border: 1px solid #D1D5DB;
    color: #111827;
}

#sort:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 2px #2563EB;
}

#clearAllBtn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background: linear-gradient(to right, #DC2626, #EF4444);
    color: #FFFFFF;
    font-size: 1.125rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
}

#clearAllBtn:hover {
    background: linear-gradient(to right, #EF4444, #F87171);
    transform: scale(1.05);
}

#clearAllBtn .icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Clipboard Grid */
.clipboard-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
    flex-grow: 1;
}

@media (min-width: 640px) {
    .clipboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .clipboard-grid {
        grid-template-columns: repeat(3, 1fr); /* Ensure 3 columns at lg breakpoint */
    }
}

@media (min-width: 1280px) {
    .clipboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1; /* Start at first column, end at last */
    text-align: center;
    padding: 3rem 0;
    /* Debugging styles to confirm visibility */
    background: rgba(0, 0, 0, 0.05); /* Light background to check span */
    min-height: 100px; /* Ensure visibility */
}

.empty-state p:first-child {
    font-size: 1.25rem;
    color: #9CA3AF;
}

[data-theme="light"] .empty-state p:first-child {
    color: #6B7280;
}

.empty-state p:last-child {
    font-size: 1.125rem;
    color: #D1D5DB;
}

[data-theme="light"] .empty-state p:last-child {
    color: #4B5563;
}

/* Clipboard Item */
.card.group {
    position: relative;
    min-height: 240px;
    transition: box-shadow 0.3s ease;
}

.card.group:hover {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.15);
}

.item-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.group:hover .item-actions {
    opacity: 1;
}

.copy-btn,
.save-btn {
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    background: #2563EB;
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

[data-theme="light"] .copy-btn,
[data-theme="light"] .save-btn {
    background: #1D4ED8;
}

.copy-btn:hover,
.save-btn:hover {
    background: #3B82F6;
}

[data-theme="light"] .copy-btn:hover,
[data-theme="light"] .save-btn:hover {
    background: #2563EB;
}

.delete-btn {
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    background: #DC2626;
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.delete-btn:hover {
    background: #EF4444;
}

.item-content img {
    width: 100%;
    height: 10rem;
    object-fit: cover;
    border-radius: 0.375rem;
}

.item-content-text p {
    font-size: 1.125rem;
    color: #E5E7EB;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
}

[data-theme="light"] .item-content-text p {
    color: #374151;
}

.item-meta {
    font-size: 0.875rem;
    color: #9CA3AF;
    margin-top: 0.75rem;
}

[data-theme="light"] .item-meta {
    color: #6B7280;
}

/* Add Item Button */
#addItemBtn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    background: linear-gradient(to right, #4B5563, #6B7280);
    color: #FFFFFF;
    font-size: 1.125rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background 0.3s ease, transform 0.3s ease;
    z-index: 50;
}

[data-theme="light"] #addItemBtn {
    background: linear-gradient(to right, #1D4ED8, #2563EB);
}

#addItemBtn:hover {
    background: linear-gradient(to right, #6B7280, #9CA3AF);
    transform: scale(1.1);
}

[data-theme="light"] #addItemBtn:hover {
    background: linear-gradient(to right, #2563EB, #3B82F6);
}

#addItemBtn .icon {
    width: 1.5rem;
    height: 1.5rem;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.75);
    z-index: 50;
    transition: all 0.3s ease;
}

[data-theme="light"] .modal-overlay {
    background: rgba(17, 24, 39, 0.4);
}

.modal-content {
    max-width: 32rem;
    width: 100%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #F3F4F6;
}

[data-theme="light"] .modal-header h2 {
    color: #111827;
}

#addItemModalCloseBtn,
#expandModalCloseBtn {
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #9CA3AF;
    transition: color 0.3s ease;
}

[data-theme="light"] #addItemModalCloseBtn,
[data-theme="light"] #expandModalCloseBtn {
    color: #6B7280;
}

[data-theme="dark"] #addItemModalCloseBtn:hover,
[data-theme="dark"] #expandModalCloseBtn:hover {
    color: #F3F4F6;
}

[data-theme="light"] #addItemModalCloseBtn:hover,
[data-theme="light"] #expandModalCloseBtn:hover {
    color: #374151;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#noteInput {
    width: 100%;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #4B5563;
    background: rgba(17, 24, 39, 0.5);
    color: #F3F4F6;
    font-size: 1.125rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="light"] #noteInput {
    background: #F9FAFB;
    border: 1px solid #D1D5DB;
    color: #111827;
}

#noteInput:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 2px #2563EB;
}

.drag-over {
    border-color: #16A34A;
    background: rgba(22, 163, 74, 0.1);
}

.button-group {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    margin-top: 1em;
    justify-content: center;
}

.button-group button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
}

#addNoteBtn {
    background: linear-gradient(to right, #4B5563, #6B7280);
}

[data-theme="light"] #addNoteBtn {
    background: linear-gradient(to right, #1D4ED8, #2563EB);
}

#addNoteBtn:hover {
    background: linear-gradient(to right, #6B7280, #9CA3AF);
    transform: scale(1.05);
}

[data-theme="light"] #addNoteBtn:hover {
    background: linear-gradient(to right, #2563EB, #3B82F6);
}

#addImageBtn {
    background: linear-gradient(to right, #4B5563, #6B7280);
}

[data-theme="light"] #addImageBtn {
    background: linear-gradient(to right, #1D4ED8, #2563EB);
}

#addImageBtn:hover {
    background: linear-gradient(to right, #6B7280, #9CA3AF);
    transform: scale(1.05);
}

[data-theme="light"] #addImageBtn:hover {
    background: linear-gradient(to right, #2563EB, #3B82F6);
}

#addNoteBtn:disabled {
    background: #4B5563;
    opacity: 0.6;
    cursor: not-allowed;
}

.button-group button .icon {
    width: 1.25rem;
    height: 1.25rem;
}

#confirmModal .modal-content {
    max-width: 32rem;
}

#confirmModalText {
    font-size: 1.25rem;
    text-align: center;
    margin-bottom: 1.5rem;
    color: #E5E7EB;
}

[data-theme="light"] #confirmModalText {
    color: #374151;
}

#confirmModalCancel {
    background: linear-gradient(to right, #4B5563, #6B7280);
}

#confirmModalCancel:hover {
    background: linear-gradient(to right, #6B7280, #9CA3AF);
    transform: scale(1.05);
}

#confirmModalConfirm {
    background: linear-gradient(to right, #DC2626, #EF4444);
}

#confirmModalConfirm:hover {
    background: linear-gradient(to right, #EF4444, #F87171);
    transform: scale(1.05);
}

#expandModal .modal-content {
    max-width: 48rem;
}

.modal-body img {
    width: 100%;
    border-radius: 0.5rem;
}

.modal-body pre {
    font-size: 1.125rem;
    padding: 1rem;
    border-radius: 0.5rem;
    background: rgba(17, 24, 39, 0.5);
    color: #E5E7EB;
}

[data-theme="light"] .modal-body pre {
    background: #F9FAFB;
    color: #374151;
}

#modalActionButtons button {
    padding: 0.5rem 0.75rem;
    font-weight: 600;
}

#modalActionButtons .icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    background: #16A34A;
    color: #FFFFFF;
    font-size: 1.125rem;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(1rem);
    transition: all 0.3s ease;
    z-index: 9999;
}

/* Hidden */
.hidden {
    display: none;
}

/* Overflow Hidden */
.overflow-hidden {
    overflow: hidden;
}





/* Action Buttons (Import/Export) */
.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background: linear-gradient(to right, #4B5563, #6B7280);
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
}

[data-theme="light"] .action-btn {
    background: linear-gradient(to right, #1D4ED8, #2563EB);
}

.action-btn:hover {
    background: linear-gradient(to right, #6B7280, #9CA3AF);
    transform: scale(1.05);
}

[data-theme="light"] .action-btn:hover {
    background: linear-gradient(to right, #2563EB, #3B82F6);
}

.action-btn .icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Import Choice Modal */
#importChoiceModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.75);
    z-index: 50;
    transition: opacity 0.3s ease; /* Only transition opacity */
}

#importChoiceModal.hidden {
    display: none !important; /* Ensure hidden takes precedence */
    opacity: 0;
}

[data-theme="light"] #importChoiceModal {
    background: rgba(17, 24, 39, 0.4);
}

#importChoiceModal .modal-content {
    max-width: 32rem;
    width: 100%;
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid #374151;
    border-radius: 0.75rem;
    padding: 1.5rem;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease; /* Only transform for content */
}

[data-theme="light"] #importChoiceModal .modal-content {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
}

#importChoiceModal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

#importChoiceModal .modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #F3F4F6;
}

[data-theme="light"] #importChoiceModal .modal-header h2 {
    color: #111827;
}

#importModalCloseBtn {
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #9CA3AF;
    transition: color 0.3s ease;
}

[data-theme="light"] #importModalCloseBtn {
    color: #6B7280;
}

[data-theme="dark"] #importModalCloseBtn:hover {
    color: #F3F4F6;
}

[data-theme="light"] #importModalCloseBtn:hover {
    color: #374151;
}

#importChoiceModal p {
    font-size: 1.125rem;
    color: #E5E7EB;
    margin-bottom: 1.5rem;
}

[data-theme="light"] #importChoiceModal p {
    color: #374151;
}

#importChoiceModal .button-group {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

#importCancelBtn,
#importAppendBtn,
#importOverwriteBtn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
}

#importCancelBtn {
    background: linear-gradient(to right, #4B5563, #6B7280);
}

[data-theme="light"] #importCancelBtn {
    background: linear-gradient(to right, #6B7280, #9CA3AF);
}

#importCancelBtn:hover {
    background: linear-gradient(to right, #6B7280, #9CA3AF);
    transform: scale(1.05);
}

[data-theme="light"] #importCancelBtn:hover {
    background: linear-gradient(to right, #9CA3AF, #D1D5DB);
}

#importAppendBtn {
    background: linear-gradient(to right, #16A34A, #22C55E);
}

[data-theme="light"] #importAppendBtn {
    background: linear-gradient(to right, #15803D, #16A34A);
}

#importAppendBtn:hover {
    background: linear-gradient(to right, #22C55E, #4ADE80);
    transform: scale(1.05);
}

[data-theme="light"] #importAppendBtn:hover {
    background: linear-gradient(to right, #16A34A, #22C55E);
}

#importOverwriteBtn {
    background: linear-gradient(to right, #DC2626, #EF4444);
}

[data-theme="light"] #importOverwriteBtn {
    background: linear-gradient(to right, #B91C1C, #DC2626);
}

#importOverwriteBtn:hover {
    background: linear-gradient(to right, #EF4444, #F87171);
    transform: scale(1.05);
}

[data-theme="light"] #importOverwriteBtn:hover {
    background: linear-gradient(to right, #DC2626, #EF4444);
}

/* Hidden File Input */
#importFileInput {
    display: none;
}