* {
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    background: #f4f6f8;
    color: #222;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

header h1 {
    margin: 0;
    font-size: 20px
}

header .header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

header button {
    padding: 8px 12px;
    border: 0;
    background: #2b8aef;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
}

header input,
header select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    padding: 24px;
    max-width: 1100px;
    margin: 0 auto
}

.card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column
}

.card img {
    width: 100%;
    height: 160px;
    object-fit: cover
}

.card-body {
    padding: 12px
}

.card-body h3 {
    margin: 0 0 6px 0
}

.tag {
    font-size: 12px;
    color: #666;
    margin: 0 0 8px 0
}

.descr {
    font-size: 13px;
    color: #333;
    margin: 0 0 12px 0
}

.actions {
    display: flex;
    gap: 8px
}

.actions button {
    flex: 1;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer
}

.actions .delete {
    border-color: #f1a0a0
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    /* Reduced gap for a tighter look */
    padding: 20px;
    margin-bottom: 40px;
}

.pagination button {
    padding: 8px 14px;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 36px;
    /* Ensure numbers have some width */
}

.pagination button:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: #ccc;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9f9f9;
}

.pagination button.active {
    background: #2b8aef;
    color: #fff;
    border-color: #2b8aef;
    box-shadow: 0 2px 4px rgba(43, 138, 239, 0.3);
    font-weight: 600;
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    z-index: 100;
}

.hidden {
    display: none !important;
}

.card-form {
    background: #fff;
    padding: 18px;
    border-radius: 8px;
    width: 360px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 8px
}

.card-form input,
.card-form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px
}

.card-form label {
    display: flex;
    flex-direction: column;
    font-size: 13px
}

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end
}

.form-actions button {
    padding: 8px 12px;
    border-radius: 6px;
    border: 0;
    cursor: pointer;
}

.form-actions #save,
.form-actions #auth-submit {
    background: #2b8aef;
    color: #fff
}

.error {
    color: #c00
}

/* Confirm modal box */
.confirm-box {
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    width: 320px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

.confirm-actions button {
    padding: 8px 12px;
    border-radius: 6px;
    border: 0;
    cursor: pointer;
}

.confirm-yes {
    background: #e74c3c;
    color: #fff
}

.confirm-no {
    background: #ddd
}

/* Toast */
.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 180ms ease, transform 180ms ease;
    z-index: 200;
}

.toast.show {
    opacity: 1;
    transform: translateY(0)
}