/* 
   Biblioteque - Modern Library Management System
   Premium Design based on Milligram CSS
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,700;1,700&display=swap');

:root {
    --primary: #1a2a6c;
    --secondary: #b21f1f;
    --accent: #fdbb2d;
    --bg: #f8f9fa;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text: #2c3e50;
    --border: #e1e4e8;
    --radius: 12px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    line-height: 1.6;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #000 100%);
    color: white;
    padding: 6rem 0 8rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://www.transparenttextures.com/patterns/dark-leather.png');
    opacity: 0.3;
}

.hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 5rem;
    margin-bottom: 1rem;
    color: var(--accent);
    letter-spacing: -2px;
    position: relative;
    z-index: 1;
}

.hero p {
    font-size: 1.8rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
    font-weight: 300;
    position: relative;
    z-index: 1;
}

/* Main Container */
.main-content {
    margin-top: -4rem;
    position: relative;
    z-index: 10;
}

.container {
    max-width: 1100px;
}

/* Cards & Sections */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 3rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 3rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

h2,
h3 {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 3rem;
}

h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 24px;
    background: var(--accent);
    border-radius: 2px;
}

/* Forms */
label {
    font-weight: 600;
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 1rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
    height: 5rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 0 1.5rem;
    transition: var(--transition);
    background-color: #fff;
    font-size: 1.6rem;
}

select {
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="%231a2a6c" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>') no-repeat;
    background-position: calc(100% - 1.5rem) center;
    background-size: 1.5rem;
    padding-right: 4rem;
    appearance: none;
    /* Treiem la fletxa per defecte del sistema */
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary) !important;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(26, 42, 108, 0.1) !important;
}

/* Buttons */
.button,
button {
    height: 4.5rem;
    padding: 0 2.5rem;
    font-weight: 600;
    border-radius: var(--radius);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: var(--transition);
}

.button:not(.button-outline) {
    background-color: var(--primary);
    border-color: var(--primary);
}

.button:not(.button-outline):hover {
    background-color: #0d1a4d;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(26, 42, 108, 0.3);
}

.button.button-outline {
    color: var(--primary);
    border-color: var(--primary);
    background-color: transparent;
}

.button.button-outline:hover {
    background-color: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(26, 42, 108, 0.2);
}

.button.button-outline:hover i {
    color: white;
}

.button.button-clear {
    color: #c94c4c !important;
    background-color: transparent !important;
    border-color: #c94c4c !important;
}

.button.button-clear:hover {
    background-color: #c94c4c !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(201, 76, 76, 0.3);
}

.button.button-outline i {
    color: var(--primary);
}

/* Custom Logout Button styling */
.logout-btn-custom {
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(5px);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border-radius: 30px !important;
}

.logout-btn-custom:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: var(--accent) !important;
    border-color: var(--accent) !important;
    transform: translateY(-2px);
}

.logout-btn-custom i {
    color: var(--accent) !important;
    font-size: 1.4rem;
}

.logout-btn-custom:hover i {
    color: #fff !important;
}

/* Table Design */
.table-wrapper {
    background: white;
    border-radius: var(--radius);
    overflow-x: auto;
    /* Permet scroll horitzontal si la taula es massa gran */
    box-shadow: var(--shadow-md);
    -webkit-overflow-scrolling: touch;
}

table {
    margin-bottom: 0;
    width: 100%;
    min-width: 900px;
    /* Assegura que la taula no s'encogexi massa */
    table-layout: auto;
}

thead {
    background: var(--primary);
}

th {
    color: white;
    padding: 3rem 2.5rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 1.6rem;
    letter-spacing: 2px;
    border-bottom: none;
}

th:first-child {
    padding-left: 4rem;
}

th:last-child {
    padding-right: 4rem;
    text-align: right;
}

td {
    padding: 2.5rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    font-size: 1.6rem;
    word-break: break-word;
    /* Força el salt de línia si el text és massa llarg */
    max-width: 250px;
    /* Limita l'amplada màxima de les columnes de text */
}

td:first-child {
    padding-left: 4rem;
}

td:last-child {
    padding-right: 4rem;
    text-align: right;
    width: 120px;
    max-width: none;
    white-space: nowrap;
    /* Evita que els botons d'acció saltin de línia */
}

/* Columna de l'Estat (pendent/llegit) */
td:nth-child(3) {
    white-space: nowrap;
    width: 100px;
}

/* Columna de Valoració (estrelles) */
td:nth-child(4) {
    white-space: nowrap;
}

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

tr:hover td {
    background-color: #fcfcfc;
}

/* Custom Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.8rem 1.8rem;
    border-radius: 30px;
    font-size: 1.3rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-pendent {
    background: #fff3cd;
    color: #856404;
}

.badge-llegit {
    background: #d4edda;
    color: #155724;
}

.star-rating {
    color: var(--accent);
    font-size: 1.2rem;
}

/* Actions */
.actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.actions button {
    height: 3.5rem;
    padding: 0 1.5rem;
    font-size: 0.9rem;
}

footer {
    text-align: center;
    padding: 5rem 0;
    color: #888;
    font-size: 1.6rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.card {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* Loading Spinner */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent);
    z-index: 1000;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

#loader.active {
    transform: scaleX(1);
}
