/**
 * KH Lab Supplies - Frontend Styles
 * Version 1.0.6 - Full Design Overhaul
 */

/* ========================================
   RESET & BASE CONTAINER
   ======================================== */
.kh-lab-supplies-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.kh-lab-supplies-container * {
    box-sizing: border-box;
}

/* ========================================
   HEADER - Hide by default since page has title
   ======================================== */
.kh-lab-header {
    display: none; /* Hide plugin title - page already has one */
}

/* ========================================
   CATEGORY SECTIONS
   ======================================== */
.kh-lab-category {
    margin-bottom: 60px;
}

.kh-lab-category-title {
    font-size: 24px;
    font-weight: 600;
    color: #00607a;
    margin: 0 0 5px 0;
    padding: 0;
}

.kh-lab-category-title::after {
    content: "";
    display: block;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, #00607a 0%, #e0e0e0 100%);
    margin-top: 8px;
    margin-bottom: 20px;
}

/* ========================================
   PRODUCTS GRID
   ======================================== */
.kh-lab-products-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 70px 30px;
    row-gap: 70px;
}

.kh-lab-supplies-container .kh-lab-products-grid {
    gap: 70px 30px;
    row-gap: 70px;
}

@media (max-width: 992px) {
    .kh-lab-supplies-container .kh-lab-products-grid,
    .kh-lab-products-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .kh-lab-supplies-container .kh-lab-products-grid,
    .kh-lab-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .kh-lab-supplies-container .kh-lab-products-grid,
    .kh-lab-products-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ========================================
   PRODUCT CARDS
   ======================================== */
.kh-lab-product-card {
    display: flex;
    flex-direction: column;
    text-align: center;
    padding: 0;
    background: transparent;
    border: none;
}

/* Product Title & Subtitle */
.kh-lab-product-info {
    margin-bottom: 8px;
    min-height: 50px;
}

.kh-lab-product-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 5px 0;
    line-height: 1.3;
}

.kh-lab-product-subtitle {
    font-size: 14px;
    color: #666;
    margin: 0;
    font-style: italic;
}

/* Product Image */
.kh-lab-product-image {
    width: 100%;
    height: auto;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    padding: 5px;
    background: transparent;
}

.kh-lab-product-image img {
    max-width: 100%;
    max-height: 180px;
    height: auto;
    object-fit: contain;
    box-shadow: 0 0 19px -5px rgba(0,0,0,0.3);
    border-radius: 3px;
}

.kh-lab-no-image {
    color: #ccc;
}

.kh-lab-no-image svg {
    width: 60px;
    height: 60px;
}

/* ========================================
   QUANTITY CONTROLS
   ======================================== */
.kh-lab-product-quantity {
    margin-top: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Unit Selector Dropdown */
.kh-lab-unit-selector {
    width: auto;
    max-width: 80px;
}

.kh-lab-unit-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 13px;
    background: #fff;
    color: #333;
    cursor: pointer;
    text-align: left;
    appearance: auto;
}

.kh-lab-unit-select:focus {
    outline: none;
    border-color: #00607a;
}

/* Quantity Input Row */
.kh-lab-qty-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.kh-lab-qty-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.kh-lab-unit-display {
    font-weight: 400;
    color: #666;
}

.kh-lab-qty-input {
    width: 55px;
    padding: 5px 4px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
    text-align: center;
    color: #333;
}

.kh-lab-qty-input:focus {
    outline: none;
    border-color: #00607a;
    box-shadow: 0 0 0 2px rgba(0, 96, 122, 0.15);
}

.kh-lab-qty-input::placeholder {
    color: #999;
}

/* Remove spinner arrows */
.kh-lab-qty-input::-webkit-outer-spin-button,
.kh-lab-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.kh-lab-qty-input[type=number] {
    -moz-appearance: textfield;
}

.kh-lab-max-hint {
    font-size: 11px;
    color: #888;
}

/* Card highlight when qty entered */
.kh-lab-product-card.has-quantity .kh-lab-qty-input {
    border-color: #00607a;
    background: #f0f8fa;
}

/* ========================================
   ORDER DETAILS SECTION
   ======================================== */
.kh-lab-order-details {
    margin-top: 40px;
    padding-top: 10px;
}

.kh-lab-section-title {
    font-size: 24px;
    font-weight: 600;
    color: #00607a;
    margin: 0 0 5px 0;
}

.kh-lab-section-title::after {
    content: "";
    display: block;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, #00607a 0%, #e0e0e0 100%);
    margin-top: 8px;
    margin-bottom: 20px;
}

.kh-lab-subsection-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0 0 15px 0;
}

.kh-lab-details-section {
    max-width: 550px;
}

/* Form Rows */
.kh-lab-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

@media (max-width: 600px) {
    .kh-lab-form-row {
        flex-direction: column;
        gap: 15px;
    }
}

.kh-lab-form-field {
    flex: 1;
}

.kh-lab-form-field-full {
    flex: none;
    width: 100%;
}

/* Labels */
.kh-lab-form-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.kh-lab-form-field label .required {
    color: #c00;
    margin-left: 2px;
}

/* Inputs */
.kh-lab-form-field input[type="text"],
.kh-lab-form-field input[type="email"],
.kh-lab-form-field input[type="tel"],
.kh-lab-form-field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s ease;
}

.kh-lab-form-field input:focus,
.kh-lab-form-field textarea:focus {
    outline: none;
    border-color: #00607a;
    box-shadow: 0 0 0 2px rgba(0, 96, 122, 0.15);
}

.kh-lab-form-field input::placeholder,
.kh-lab-form-field textarea::placeholder {
    color: #999;
}

.kh-lab-form-field textarea {
    resize: vertical;
    min-height: 80px;
}

.kh-lab-form-field .field-description {
    font-size: 12px;
    color: #666;
    margin: 5px 0 0 0;
    font-style: italic;
}

/* ========================================
   SUBMIT BUTTON
   ======================================== */
.kh-lab-form-actions {
    margin-top: 25px;
}

.kh-lab-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 35px;
    background: #00607a;
    color: #fff !important;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kh-lab-submit-btn:hover {
    background: #004d61;
}

.kh-lab-submit-btn:disabled {
    background: #999;
    cursor: not-allowed;
}

.kh-lab-submit-btn .btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kh-lab-submit-btn .spinner {
    animation: kh-lab-spin 1s linear infinite;
}

@keyframes kh-lab-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   FORM MESSAGES
   ======================================== */
.kh-lab-form-messages {
    margin-top: 20px;
    padding: 12px 15px;
    border-radius: 3px;
    font-size: 14px;
}

.kh-lab-form-messages.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.kh-lab-form-messages.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ========================================
   LOGIN REQUIRED STATE
   ======================================== */
.kh-lab-login-required {
    text-align: center;
    padding: 60px 20px;
}

.kh-lab-login-message {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.kh-lab-login-message svg {
    color: #00607a;
    margin-bottom: 20px;
}

.kh-lab-login-message h3 {
    font-size: 20px;
    color: #333;
    margin: 0 0 10px 0;
}

.kh-lab-login-message p {
    color: #666;
    margin: 0 0 20px 0;
}

.kh-lab-login-btn {
    display: inline-block;
    padding: 12px 30px;
    background: #00607a;
    color: #fff;
    text-decoration: none;
    border-radius: 3px;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.kh-lab-login-btn:hover {
    background: #004d61;
    color: #fff;
}

/* ========================================
   NOTICE / EMPTY STATE
   ======================================== */
.kh-lab-supplies-notice {
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    text-align: center;
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .kh-lab-submit-btn,
    .kh-lab-form-actions {
        display: none;
    }
}
