/* =======================================
   General & Form Styles
   ======================================= */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f4f7f6;
    color: #333;
}

h1, h2 {
    color: #004d40; /* Dark Teal */
    border-bottom: 2px solid #e0f2f1;
    padding-bottom: 5px;
}

/* Form Styles */
.specimen-form {
    max-width: 700px;
    margin-bottom: 40px;
    padding: 20px;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.field-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    position: relative;
    /* Ensure flex items wrap on smaller screens within the container */
    flex-wrap: wrap; 
}

.field-group label {
    width: 150px;
    font-weight: bold;
    color: #00796b; /* Medium Teal */
    flex-shrink: 0;
    margin-right: 10px;
}

.field-group input[type="text"], 
.field-group input[type="number"], 
.field-group select,
.field-group input[type="file"] {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.3s;
}
.field-group input[type="text"]:focus, 
.field-group input[type="number"]:focus, 
.field-group select:focus {
    border-color: #009688;
    outline: none;
}

/* Checkbox specific spacing */
.field-group input[type="checkbox"] {
    margin-right: 5px;
}

/* Button Styling (for Add Dropdown) */
.field-group button {
    margin-left: 10px;
    padding: 8px 15px;
    background-color: #4db6ac; /* Light Teal */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.3s;
}
.field-group button:hover {
    background-color: #009688;
}

.submit-btn {
    padding: 12px 25px;
    background-color: #00796b; /* Main Action Color */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 15px;
    display: block;
    width: 100%;
    transition: background-color 0.3s;
}
.submit-btn:hover {
    background-color: #004d40;
}

/* --- Quicksilver Search/Dropdown Styles --- */
.search-results {
    list-style: none;
    padding: 0;
    margin: 0;
    position: absolute;
    top: 100%; 
    left: 160px; /* Adjust based on label width + margin */
    right: 0;
    width: calc(100% - 170px); 
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #00796b;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 50;
    display: none;
    border-radius: 4px;
}
.search-results li {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}
.search-results li:hover {
    background-color: #e0f2f1;
}
.hidden-select {
    position: absolute;
    left: -9999px; 
}
/* Ensure input field fills space within a wrapped line */
.searchable-dropdown-container input[type="text"] {
    margin-bottom: 5px; 
}

/* =======================================
   Table Styles (Desktop First)
   ======================================= */
.specimen-table {
//    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.td-right {
	text-align: right;
	font-family: monospace;
	white-space: pre;
}

.specimen-table th, .specimen-table td {
    border: 1px solid #e0e0e0;
    padding: 8px;
//    text-align: left;
}

.specimen-table th {
    background-color: #00796b;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
}

.specimen-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.specimen-table a {
    color: #009688;
    text-decoration: none;
    transition: color 0.3s;
}
.specimen-table a:hover {
    color: #004d40;
}


/* =======================================
   Mobile Responsive Overrides
   (Converts table to cards for small screens)
   ======================================= */
@media screen and (max-width: 768px) {
    body {
        padding: 10px;
    }

    /* Adjust form layout for mobile */
    .field-group {
        flex-direction: column; /* Stack label and input */
        align-items: flex-start;
    }

    .field-group label {
        width: 100%;
        margin-bottom: 5px;
        margin-right: 0;
    }

    .field-group input[type="text"], 
    .field-group input[type="number"], 
    .field-group select,
    .field-group input[type="file"] {
        width: 100%;
        margin-bottom: 5px;
    }
    
    /* Move the "Add New" button below the input/select */
    .field-group button {
        margin-left: 0;
        margin-top: 5px;
        width: 100%;
        box-sizing: border-box;
    }

    /* Fix searchable results positioning */
    .search-results {
        left: 0;
        width: 100%;
        top: 100%;
    }


    /* --- Table Card View --- */
    .specimen-table {
        border: 0;
    }

    .specimen-table caption {
        font-size: 1.3em;
    }

    /* Hide table headers (but make them available for screen readers) */
    .specimen-table thead {
        border: none;
        clip: rect(0 0 0 0);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        width: 1px;
    }

    .specimen-table tr {
        border: 1px solid #ddd;
        display: block;
        margin-bottom: .625em; /* Space out the "cards" */
        background-color: #fff;
        border-radius: 6px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    /* Simulate table cells as blocks */
    .specimen-table td {
        border-bottom: 1px solid #ddd;
        display: block;
        text-align: right;
        font-size: .8em;
        padding: 10px;
        position: relative;
    }

    .specimen-table td::before {
        /* Use the data attributes from the PHP to display the column name */
        content: attr(data-label);
        float: left;
        font-weight: bold;
        text-transform: uppercase;
        color: #004d40;
    }

    /* Ensure the last cell of each row doesn't have a bottom border */
    .specimen-table td:last-child {
        border-bottom: 0;
    }
}
