/* Component styles - Buttons, forms, tables, modals, cards */

/* Form elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--dark-gray);
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray);
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--dark-green);
    box-shadow: 0 0 0 3px rgba(27, 67, 50, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group-full {
    grid-column: 1 / -1;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
}

select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-add {
    background: var(--dark-green);
    color: var(--white);
}

.btn-add:hover {
    background: var(--medium-green);
}

.btn-edit {
    background: var(--navy);
    color: var(--white);
    padding: 6px 12px;
    font-size: 12px;
}

.btn-delete {
    background: var(--error);
    color: var(--white);
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
    color: var(--dark-gray);
    transition: all 0.3s;
}

.btn-icon:hover {
    color: var(--dark-green);
}

.btn-cancel {
    background: var(--gray);
    color: var(--text-dark);
}

.btn-favorite {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s;
}

.btn-favorite.active {
    color: var(--error);
}

/* Section */
.section {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--light-gray);
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark-green);
}

/* Search and Filters */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    border: 1px solid var(--gray);
    border-radius: 6px;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--dark-green);
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid var(--gray);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

/* Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--light-gray);
}

th {
    text-align: left;
    padding: 12px;
    font-weight: 600;
    color: var(--dark-green);
    font-size: 14px;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--gray);
    font-size: 14px;
}

tr:hover {
    background: var(--light-gray);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-active {
    background: #E8F5E9;
    color: #2E7D32;
}

.status-inactive {
    background: #FFEBEE;
    color: #C62828;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal {
    background: var(--white);
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.modal-large {
    max-width: 800px;
}

.modal-full {
    max-width: 95vw;
    max-height: 95vh;
    height: 90vh;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: var(--dark-green);
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--dark-gray);
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--dark-gray);
}

.empty-state-icon {
    font-size: 60px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* Activity Log */
.activity-list {
    list-style: none;
}

.activity-item {
    padding: 12px;
    border-bottom: 1px solid var(--gray);
    display: flex;
    gap: 12px;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    font-size: 20px;
    color: var(--dark-green);
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.activity-time {
    font-size: 12px;
    color: var(--dark-gray);
}

/* Institutional component polish */
.section {
    border: 1px solid rgba(18, 55, 40, 0.08);
}

.section-title {
    color: var(--dark-green);
}

.section-title::after {
    content: '';
    display: block;
    width: 52px;
    height: 3px;
    background: var(--gold);
    margin-top: 8px;
    border-radius: 999px;
}

.btn-add, .btn-primary {
    letter-spacing: 0.01em;
}

/* Portada institucional para libros sin imagen */
.book-cover-image {
    width: 100%;
    max-width: 220px;
    height: 300px;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
    background: #f4f4f4;
}

.institutional-cover {
    width: 100%;
    max-width: 220px;
    height: 300px;
    border-radius: 14px;
    background: linear-gradient(145deg, #0b2f24, #174b3a);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 22px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(212, 175, 55, 0.45);
}

.institutional-cover-mark {
    align-self: flex-start;
    border: 1px solid rgba(212, 175, 55, 0.85);
    color: #d4af37;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
}

.institutional-cover-title {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.35;
}

.book-card-cover-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}

.book-card-institutional-cover {
    width: 100%;
    height: 180px;
    border-radius: 12px;
    background: linear-gradient(145deg, #0b2f24, #174b3a);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px;
    border: 1px solid rgba(212, 175, 55, 0.45);
}

.book-card-cover-mark {
    align-self: flex-start;
    border: 1px solid rgba(212, 175, 55, 0.85);
    color: #d4af37;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
}

.book-card-cover-title {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.3;
}


/* Mensajes emergentes institucionales */
.toast-container {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(420px, calc(100vw - 32px));
}

.toast {
    padding: 14px 16px;
    border-radius: 14px;
    background: #ffffff;
    color: #1f2937;
    border-left: 5px solid #0f5132;
    box-shadow: 0 16px 35px rgba(0, 0, 0, 0.18);
    font-size: 0.92rem;
    line-height: 1.35;
    animation: toastIn 0.25s ease-out;
}

.toast-success {
    border-left-color: #198754;
}

.toast-error {
    border-left-color: #b42318;
}

.toast-warning {
    border-left-color: #d4af37;
}

.toast-info {
    border-left-color: #1d4ed8;
}

.toast-hide {
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Confirmaciones profesionales */
.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.confirm-dialog {
    width: min(460px, 100%);
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.confirm-header {
    padding: 18px 22px;
    background: linear-gradient(135deg, #0b2f24, #164c3a);
    color: #ffffff;
}

.confirm-header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.confirm-body {
    padding: 22px;
    color: #374151;
    line-height: 1.45;
}

.confirm-footer {
    padding: 16px 22px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #e5e7eb;
}

/* Portadas institucionales */
.book-cover-image,
.book-card-cover-image {
    width: 100%;
    object-fit: cover;
    border-radius: 14px;
    background: #f4f4f4;
}

.book-cover-image {
    max-width: 220px;
    height: 300px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

.book-card-cover-image {
    height: 180px;
    display: block;
}

.institutional-cover {
    width: 100%;
    max-width: 220px;
    height: 300px;
    border-radius: 14px;
    background: linear-gradient(145deg, #0b2f24, #174b3a);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 22px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(212, 175, 55, 0.45);
}

.institutional-cover-mark,
.book-card-cover-mark {
    align-self: flex-start;
    border: 1px solid rgba(212, 175, 55, 0.85);
    color: #d4af37;
    font-weight: 700;
    letter-spacing: 0.08em;
    border-radius: 999px;
}

.institutional-cover-mark {
    padding: 6px 10px;
    font-size: 0.75rem;
}

.institutional-cover-title {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.35;
}

.book-card-institutional-cover {
    width: 100%;
    height: 180px;
    border-radius: 12px;
    background: linear-gradient(145deg, #0b2f24, #174b3a);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px;
    border: 1px solid rgba(212, 175, 55, 0.45);
}

.book-card-cover-mark {
    padding: 4px 8px;
    font-size: 0.7rem;
}

.book-card-cover-title {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.3;
}

/* Grupos académicos */
.group-panel {
    margin-bottom: 1.4rem;
}

.group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.group-box {
    background: #ffffff;
    border: 1px solid rgba(12, 46, 37, 0.12);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
}

.group-box h4 {
    margin: 0 0 0.75rem 0;
    color: #0b2f24;
}

.group-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.group-row:last-child {
    border-bottom: 0;
}

.group-actions-inline {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn-sm {
    padding: 0.42rem 0.65rem;
    font-size: 0.82rem;
}

.muted {
    color: #667085;
    margin: 0.25rem 0;
}

.compact-list {
    margin-top: 0.8rem;
}

.status-warning {
    background: #fff4d6;
    color: #8a6200;
    border: 1px solid #f0c36a;
}
