@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --success-color: #10b981;
    --success-hover: #059669;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-border: rgba(255, 255, 255, 0.4);
    --text-primary: #111827;
    --text-secondary: #374151;
    --glass-shadow: 0 10px 40px -10px rgba(31, 38, 135, 0.15);
    --radius: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    /* A sky blue animated gradient background */
    background: linear-gradient(-45deg, #4facfe, #00f2fe, #23a6d5, #66a6ff);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    line-height: 1.6;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Glassmorphism Container with Fade-in Animation */
.container, form, .glass-panel {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    padding: 35px;
    width: 100%;
    max-width: 500px;
    margin: 20px auto;
    text-align: center;
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform: translateY(20px);
    opacity: 0;
}

@keyframes fadeInUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.container-large {
    max-width: 1000px;
}

h1, h2, h3 {
    color: var(--text-primary);
    margin-bottom: 25px;
    text-align: center;
    font-weight: 800;
    letter-spacing: -0.03em;
}

h1 {
    font-size: 2.8rem;
    color: #111827;
    text-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

p {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 1.05rem;
}

.welcome-text {
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 35px;
    background: rgba(99, 102, 241, 0.08);
    padding: 15px 25px;
    border-radius: 16px;
    display: inline-block;
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

.welcome-text strong {
    color: var(--primary-color);
    font-weight: 800;
    text-transform: capitalize;
}

/* Inputs & Forms */
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    text-align: left;
}

input, select {
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 22px;
    border: 2px solid transparent;
    border-radius: 12px;
    background-color: rgba(243, 244, 246, 0.8);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2), inset 0 2px 4px rgba(0,0,0,0.01);
    transform: translateY(-2px);
}

/* Buttons and Links */
button, .btn, a.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: inherit;
    text-transform: capitalize;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

button[type="submit"], button[name="login"] {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: #ffffff;
    width: 100%;
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4);
}

button[type="submit"]:hover, button[name="login"]:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.6);
}

button[onclick="window.print()"] {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    color: white;
    margin-top: 20px;
    width: auto;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

button[onclick="window.print()"]:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.6);
}

a.btn-action {
    background: var(--surface);
    color: var(--primary-color);
    border: 1px solid rgba(79, 70, 229, 0.2);
    margin: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

a.btn-action:hover {
    background: rgba(79, 70, 229, 0.05);
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    color: var(--primary-color);
}

/* User wants delete button to stay as is, but we will animate it */
a[href*="delete_book"] {
    background-color: var(--danger-color) !important;
    color: white !important;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

a[href*="delete_book"]:hover {
    background-color: var(--danger-hover) !important;
    transform: scale(1.1) rotate(-2deg);
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.6);
}

a[href="logout.php"] {
    color: var(--danger-color);
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.1);
    font-weight: 700;
    text-decoration: none;
    margin-left: 10px;
    transition: all 0.3s ease;
}
a[href="logout.php"]:hover {
    background: var(--danger-color);
    color: #fff;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

a[href="index.php"], .back-link {
    display: inline-block;
    text-align: center;
    margin-top: 25px;
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
}
a[href="index.php"]:hover, .back-link:hover {
    background: var(--primary-color);
    color: #ffffff;
    transform: translateX(-5px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    margin-top: 25px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

table {
    width: 100%;
    min-width: 750px;
    border-collapse: collapse;
}

th, td {
    padding: 18px 22px;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    color: var(--text-primary);
}

th {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-hover);
    font-weight: 800;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 3px solid rgba(99, 102, 241, 0.2);
}

tr {
    transition: background-color 0.2s ease, transform 0.2s ease;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background-color: rgba(255, 255, 255, 0.9);
    transform: scale(1.01);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    z-index: 10;
    position: relative;
}

/* Dashboard Actions */
.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-top: 35px;
}

/* Utilities */
.success {
    color: #047857;
    background: #d1fae5;
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 25px;
    border-left: 5px solid #10b981;
    font-weight: 600;
    text-align: center;
    animation: slideInDown 0.5s ease forwards;
}

.error {
    color: #b91c1c;
    background: #fee2e2;
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 25px;
    border-left: 5px solid #ef4444;
    font-weight: 600;
    text-align: center;
    animation: slideInDown 0.5s ease forwards;
}

@keyframes slideInDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .container, form, .glass-panel {
        padding: 25px;
    }

    h1 {
        font-size: 2.2rem;
    }
    
    .dashboard-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    a.btn-action {
        width: 100%;
        margin: 0;
    }
    
    a[href="index.php"], .back-link {
        width: 100%;
        margin-top: 20px;
    }
}
