/* ===================================
   La Librería de Cata - Redesign
   Warm, cozy book library aesthetic
   =================================== */

/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

/* CSS Variables */
:root {
    --primary: #d97706;
    /* Warm amber */
    --primary-dark: #b45309;
    --primary-light: #fbbf24;
    --accent: #dc2626;
    /* Red for actions */
    --accent-dark: #b91c1c;
    --bg-gradient-start: #fef3c7;
    --bg-gradient-end: #fde68a;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-primary: #451a03;
    --text-secondary: #78350f;
    --text-muted: #92400e;
    --shadow-soft: 0 4px 20px rgba(180, 83, 9, 0.15);
    --shadow-hover: 0 8px 30px rgba(180, 83, 9, 0.25);
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 1rem;
}

/* Main Container - Glassmorphism */
.container {
    width: 90%;
    max-width: 420px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.5);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.5s ease-out;
}

/* Prevent squashing in flex container */
.container>* {
    flex-shrink: 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Floating Mascot Animation */
#mascot {
    max-width: 100%;
    max-height: 220px;
    height: auto;
    object-fit: contain;
    margin-bottom: 0.5rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
    flex-shrink: 1;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 8px 16px rgba(180, 83, 9, 0.2));
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.mascot-small {
    height: 150px;
    width: auto;
    display: block;
    margin: 0 auto 0.5rem auto;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(180, 83, 9, 0.2));
}

/* Title */
h1,
h2,
h3 {
    color: var(--text-primary);
    margin: 0.5rem 0;
    font-weight: 800;
}

h1 {
    font-size: 1.6rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Inputs */
input {
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 16px;
    font-size: 1.1rem;
    font-family: inherit;
    border: 2px solid rgba(217, 119, 6, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-primary);
    transition: var(--transition);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.1);
}

input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
button {
    width: 100%;
    padding: 14px 20px;
    font-size: 1.1rem;
    line-height: 1.5;
    font-family: inherit;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

/* ... existing hover effects ... */

/* Text/Link Buttons */
.text-btn {
    width: auto !important;
    background: transparent !important;
    color: var(--text-secondary) !important;
    padding: 8px 12px !important;
    font-size: 0.9rem !important;
    box-shadow: none !important;
    display: inline-block;
}

.text-btn:hover {
    background: rgba(217, 119, 6, 0.1) !important;
    transform: none !important;
    box-shadow: none !important;
}

.text-btn::before {
    display: none;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Action Button Primary */
.action-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

/* Action Button Secondary (Red) */
.action-btn.secondary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    font-size: 1rem;
    padding: 1rem 1.5rem;
    margin-top: 1rem;
    cursor: pointer;
}

.action-btn.secondary:hover {
    background: linear-gradient(135deg, var(--accent-dark) 0%, #991b1b 100%);
}

/* Secondary/Ghost Button */
.secondary-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid rgba(217, 119, 6, 0.3);
}

.secondary-btn:hover {
    background: rgba(217, 119, 6, 0.1);
    border-color: var(--primary);
}

/* Icon Button */
.icon-btn {
    width: auto;
    background: rgba(217, 119, 6, 0.1);
    color: var(--primary);
    margin-left: 10px;
    font-size: 1.3rem;
    padding: 12px;
    border-radius: 10px;
}

.icon-btn:hover {
    background: rgba(217, 119, 6, 0.2);
}

/* Input Group */
.input-group {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    gap: 8px;
}

.input-group input {
    margin-bottom: 0;
    flex: 1;
}

/* Status Messages */
.status {
    margin-top: 16px;
    font-size: 1rem;
    min-height: 1.5em;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition);
}

.status.error {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
}

.status.success {
    color: #16a34a;
    background: rgba(22, 163, 74, 0.1);
}

.status.info {
    color: var(--primary);
    background: rgba(217, 119, 6, 0.1);
}

/* Results List */
.results-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
}

/* Result Item Card */
.result-item {
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(180, 83, 9, 0.08);
    border: 1px solid rgba(217, 119, 6, 0.1);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
    animation: fadeInUp 0.3s ease-out;
    animation-fill-mode: both;
}

.result-item:nth-child(1) {
    animation-delay: 0.05s;
}

.result-item:nth-child(2) {
    animation-delay: 0.1s;
}

.result-item:nth-child(3) {
    animation-delay: 0.15s;
}

.result-item:nth-child(4) {
    animation-delay: 0.2s;
}

.result-item:nth-child(5) {
    animation-delay: 0.25s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-item:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 6px 20px rgba(180, 83, 9, 0.15);
    border-color: var(--primary-light);
}

/* Book Cover */
.book-cover {
    width: 50px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    flex-shrink: 0;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.1);
}

/* Result Info */
.result-info {
    flex: 1;
}

.result-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    font-size: 1rem;
    line-height: 1.3;
}

.result-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Modal Styling */
#confirmation-modal>div,
#edit-user-modal>div,
#password-modal>div {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(217, 119, 6, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Loading Animation */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
        border-radius: 20px;
    }

    #mascot {
        max-height: 180px;
    }

    button {
        padding: 12px 20px;
        font-size: 1rem;
    }

    input {
        padding: 12px 14px;
        font-size: 1rem;
    }
}

/* Dark mode support (optional - respects system preference) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-gradient-start: #451a03;
        --bg-gradient-end: #78350f;
        --card-bg: rgba(30, 30, 30, 0.85);
        --text-primary: #fef3c7;
        --text-secondary: #fde68a;
        --text-muted: #fbbf24;
    }

    input {
        background: rgba(50, 50, 50, 0.8);
        border-color: rgba(217, 119, 6, 0.3);
    }

    .result-item {
        background: rgba(50, 50, 50, 0.9);
    }
}