:root {
    --background-start: #f1f5f9;
    --background-end: #cbd5e1;
    --card-bg: rgba(255, 255, 255, 0.75);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --border: #e2e8f0;
    --input-border: #94a3b8;
    --radius: 0.75rem;
    --shadow: 0 8px 24px rgba(0,0,0,0.08);
    --success: #16a34a;
    --warning: #f97316;
    --quill-bg: #ffffff;
}

body[data-theme='dark'] {
    --background-start: #1e293b;
    --background-end: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.75);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --input-border: #475569;
    --quill-bg: #1e293b;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-image: linear-gradient(to bottom right, var(--background-start), var(--background-end));
    color: var(--text-primary);
    padding: 2rem 1rem;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

#app-container { 
    max-width: 75rem; 
    margin: 0 auto; 
}

.header { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    position: relative; 
    margin-bottom: 2rem; 
}

.header h1 { 
    font-size: 2.25rem; 
    font-weight: 700; 
    text-align: center; 
    letter-spacing: -0.025em; 
    margin: 0; 
}

.header img { 
    height: 48px; 
    margin-right: 0.75rem; 
}

#theme-toggle {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    background: none;
    border: 1px solid var(--input-border);
    border-radius: 9999px;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

#theme-toggle:hover { 
    background-color: var(--border); 
}

#theme-toggle svg { 
    width: 20px; 
    height: 20px; 
}

.controls-grid { 
    display: flex; 
    flex-direction: column; 
    gap: 1.5rem; 
    margin-bottom: 2rem; 
}

.search-controls, .tag-search-controls, .io-controls { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 0.75rem; 
}

.controls-grid input, .controls-grid select {
    padding: 0.75rem 1rem; 
    font-size: 1rem; 
    border-radius: var(--radius); 
    border: 1px solid var(--input-border);
    background-color: var(--quill-bg); 
    color: var(--text-primary); 
    transition: all 0.2s ease; 
    flex-grow: 1;
}

.controls-grid input:focus, .controls-grid select:focus {
    outline: none; 
    border-color: var(--primary); 
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.controls-grid button {
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    gap: 0.5rem; 
    padding: 0.75rem 1.5rem;
    font-size: 1rem; 
    font-weight: 600; 
    border-radius: var(--radius); 
    border: none; 
    cursor: pointer;
    transition: background-color 0.2s ease; 
    white-space: nowrap;
}

#search-button, #tag-search-button { background-color: var(--primary); color: #fff; }
#search-button:hover, #tag-search-button:hover { background-color: var(--primary-hover); }
#random-button { background-color: var(--text-secondary); color: #fff; }
#random-button:hover { background-color: var(--text-primary); }
#export-button { background-color: var(--success); color: #fff; }
#export-button:hover { background-color: #15803d; }
#import-button { background-color: var(--warning); color: #fff; }
#import-button:hover { background-color: #c2410c; }

#history-container { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 0.5rem; 
    justify-content: center; 
    margin-bottom: 2rem; 
}

.history-item {
    background-color: transparent; 
    color: var(--text-secondary); 
    padding: 0.5rem 1rem; 
    border-radius: 9999px;
    font-size: 0.875rem; 
    cursor: pointer; 
    transition: all 0.2s ease; 
    border: 1px solid var(--input-border);
}

.history-item:hover { 
    background-color: var(--text-secondary); 
    color: #fff; 
    border-color: var(--text-secondary); 
}

.main-layout { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 1.5rem; 
}

@media (min-width: 992px) { 
    .main-layout { 
        grid-template-columns: 3fr 2fr; 
    } 
}

.card {
    background-color: var(--card-bg); 
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius); 
    border: 1px solid rgba(255, 255, 255, 0.6); 
    box-shadow: var(--shadow);
    padding: 1.5rem; 
    min-height: 300px;
}

.card-title { 
    font-size: 1.25rem; 
    font-weight: 600; 
    margin-bottom: 1rem; 
    color: var(--text-primary); 
}

#result-container .card-content p { 
    line-height: 1.75; 
    font-size: 1.1rem; 
}

.verse-number { 
    font-weight: bold; 
    color: var(--primary); 
    margin-right: 0.5rem; 
}

.initial-state, .error, .loading-spinner-wrapper { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    height: 100%; 
    color: var(--text-secondary); 
    font-style: italic; 
}

.error { 
    color: #dc2626; 
    font-weight: 600; 
}

.loading-spinner { 
    width: 40px; 
    height: 40px; 
    border: 4px solid rgba(0,0,0,0.1); 
    border-left-color: var(--primary); 
    border-radius: 50%; 
    animation: spin 1s linear infinite; 
}

@keyframes spin { 
    to { 
        transform: rotate(360deg); 
    } 
}

#notes-editor { 
    display: none; 
}

#tags-input { 
    width: 100%; 
    padding: 0.75rem; 
    border-radius: var(--radius); 
    border: 1px solid var(--input-border); 
    font-size: 1rem; 
    margin-top: 1rem; 
    background-color: var(--quill-bg); 
    color: var(--text-primary); 
}

#notes-display h3 { 
    font-size: 1rem; 
    font-weight: 600; 
    color: var(--text-primary); 
    margin-bottom: 1rem; 
    border-bottom: 1px solid var(--border); 
    padding-bottom: 0.5rem; 
}

.note-item { 
    margin-bottom: 1.5rem; 
    padding-bottom: 1.5rem; 
    border-bottom: 1px solid var(--border); 
}

.note-item:last-child { 
    border-bottom: none; 
    padding-bottom: 0; 
}

.note-title { 
    font-weight: bold; 
    color: var(--primary); 
    cursor: pointer; 
}

.note-title:hover { 
    text-decoration: underline; 
}

.note-content { 
    word-wrap: break-word; 
    font-size: 0.9rem; 
    margin-top: 0.5rem; 
}

.note-content * { 
    color: var(--text-secondary) !important; 
    background-color: transparent !important; 
}

.note-tags { 
    margin-top: 0.75rem; 
    display: flex; 
    flex-wrap: wrap; 
    gap: 0.5rem; 
}

.note-tag { 
    background-color: #e0e7ff; 
    color: #4338ca; 
    padding: 0.25rem 0.75rem; 
    border-radius: 9999px; 
    font-size: 0.75rem; 
    font-weight: 500; 
}

/* Quill Editor Styles */
#notes-editor-quill { 
    height: 150px; 
    background-color: var(--quill-bg); 
    border-radius: var(--radius); 
}

.ql-toolbar { 
    border-top-left-radius: var(--radius); 
    border-top-right-radius: var(--radius); 
    border-color: var(--input-border) !important; 
}

.ql-container { 
    border-bottom-left-radius: var(--radius); 
    border-bottom-right-radius: var(--radius); 
    border-color: var(--input-border) !important; 
}

.ql-editor { 
    color: var(--text-primary); 
}

.ql-snow .ql-stroke { 
    stroke: var(--text-secondary); 
}

.ql-snow .ql-picker-label { 
    color: var(--text-secondary) !important; 
}
.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.delete-note-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 5px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.delete-note-btn:hover {
    opacity: 1;
    color: #ff4d4d; /* Un color rojo para indicar peligro */
}
