/* ===============================
   PAGE HEADER
=================================*/
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-header h1 {
    margin: 0;
    font-size: 26px;
}

.page-header p {
    margin: 5px 0 0;
    color: #777;
    font-size: 14px;
}

.add-btn {
    background: #2bb8a9;
    color: white;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
}

.add-btn:hover {
    background: #249e91;
}

/* ===============================
   CARDS
=================================*/
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.card h3 {
    margin: 0;
    font-size: 24px;
}

.card p {
    margin: 5px 0 0;
    color: #777;
    font-size: 13px;
}

.card i {
    font-size: 28px;
    color: #2bb8a9;
}

/* ===============================
   SEARCH BOX
=================================*/
.box {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.box form input,
.box form select {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 14px;
}

.btn.primary {
    background: #2bb8a9;
    color: white;
    border: none;
}

.btn.cancel {
    background: #ccc;
    color: black;
    text-decoration: none;
}

/* ===============================
   TABLE
=================================*/
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

table th {
    background: #f5f7fa;
    text-align: left;
    padding: 12px;
    font-size: 13px;
}

table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    vertical-align: middle;
}

table tr:hover {
    background: #f9f9f9;
}

.qr-small {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-right: 8px;
}

/* ===============================
   STATUS BADGE
=================================*/
.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-active {
    background: #d4f8e8;
    color: #1a9c6d;
}

.badge-maintenance {
    background: #fff4d6;
    color: #b07a00;
}

.badge-inactive {
    background: #fde2e2;
    color: #c0392b;
}

/* ===============================
   ALERTS
=================================*/
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
}

.alert.success {
    background: #d4f8e8;
    color: #1a9c6d;
}

.alert.error {
    background: #fde2e2;
    color: #c0392b;
}

/* ===============================
   MODAL
=================================*/
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-box {
    background: white;
    padding: 25px;
    width: 500px;
    max-width: 95%;
    border-radius: 12px;
    animation: fadeIn 0.2s ease-in-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.close {
    cursor: pointer;
    font-size: 18px;
}

/* ===============================
   MODAL FORM 2-COLUMN FLEX
=================================*/
.modal-box form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.modal-box form .form-group {
    flex: 1 1 48%; /* 2 columns */
    display: flex;
    flex-direction: column;
}

.modal-box form .form-group label {
    font-weight: 600;
    margin-bottom: 4px;
}

.modal-box form .form-group input,
.modal-box form .form-group select,
.modal-box form .form-group textarea {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
    width: 100%;
    box-sizing: border-box;
}

.modal-box form textarea {
    height: 60px;
    resize: none;
}

/* Equipment image & modal actions span full width */
.modal-box form .form-group.full-width {
    flex: 1 1 100%;
}

.modal-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

@keyframes fadeIn {
    from {opacity:0; transform:scale(0.95);}
    to {opacity:1; transform:scale(1);}
}

/* ===============================
   BUTTONS GLOBAL
=================================*/
button,
.btn,
.add-btn {
    border: none;
    outline: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    padding: 10px 16px;
    transition: 0.2s ease-in-out;
}

.btn.primary,
.add-btn {
    background: #2bb8a9;
    color: white;
}

.btn.primary:hover,
.add-btn:hover {
    background: #249e91;
}

.btn.cancel {
    background: #e5e7eb;
    color: #333;
}

.btn.cancel:hover {
    background: #d1d5db;
}

/* ===============================
   SEARCH FORM
=================================*/
.search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 20px;
}

.search-form input,
.search-form select {
    height: 40px;
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 0 12px;
    font-size: 14px;
}

.search-form input {
    flex: 1;
    min-width: 200px;
}

.search-form button,
.search-form a {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive: modal 2-column becomes 1-column */
@media(max-width: 480px){
    .modal-box form .form-group {
        flex: 1 1 100%;
    }
}

/* ===============================
   FIX SELECT ARROW BUG
================================ */

/* Remove browser default arrow */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;

    padding-right: 36px;
}

/* Remove weird edge arrows (Windows / Edge) */
select::-ms-expand {
    display: none;
}

/* Prevent text clipping */
.form-group select {
    line-height: 1.4;
}

/* ===============================
   ACTION BUTTON
=================================*/
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: 0.2s ease-in-out;
}

.view-btn {
    background: #e6f7f5;
    color: #2bb8a9;
    border: 1px solid #2bb8a9;
}

.view-btn:hover {
    background: #2bb8a9;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(43,184,169,0.3);
}

.action-btn i {
    font-size: 12px;
}

/* =========================
   STATUS BADGES
========================= */
.status-badge {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
}

/* Active = Green */
.status-active {
    background: #dcfce7;
    color: #166534;
}

/* Under Maintenance = Yellow */
.status-under-maintenance {
    background: #fef9c3;
    color: #92400e;
}

/* Inactive = Red/Grey */
.status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

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

/* ===============================
   ADD EQUIPMENT MODAL GRID
=================================*/
.modal-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 20px;
    width: 100%;
}

.modal-form-grid .form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.modal-form-grid .form-group label {
    font-weight: 600;
    font-size: 13px;
    color: #374151;
}

.modal-form-grid .form-group input,
.modal-form-grid .form-group select,
.modal-form-grid .form-group textarea {
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
    transition: border 0.2s;
}

.modal-form-grid .form-group input:focus,
.modal-form-grid .form-group select:focus,
.modal-form-grid .form-group textarea:focus {
    border-color: #2bb8a9;
    outline: none;
    box-shadow: 0 0 0 3px rgba(43,184,169,0.1);
}

.modal-form-grid .form-group textarea {
    height: 70px;
    resize: none;
}

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

.field-hint {
    color: #9ca3af;
    font-weight: 400;
    font-size: 11px;
}