/* Kingsway Gold POS Calculator - Frontend Styles */
/* Version: 1.1.0 - Updated: 2024-11-27 */

:root {
    --kgpos-primary: #D4AF37;
    --kgpos-secondary: #1a1a1a;
    --kgpos-accent: #F5E6D3;
    --kgpos-success: #10B981;
    --kgpos-danger: #EF4444;
    --kgpos-warning: #F59E0B;
    --kgpos-bg: #FAFAF9;
    --kgpos-card-bg: #FFFFFF;
    --kgpos-border: #E5E7EB;
    --kgpos-text: #111827;
    --kgpos-text-light: #6B7280;
    --kgpos-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --kgpos-radius: 12px;
}

* {
    box-sizing: border-box;
}

/* Main Wrapper */
.kgpos-calculator-wrapper {
    max-width: 1100px;
    margin: 2rem auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
}

/* Header */
.kgpos-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 1.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #D4AF37;
}

.kgpos-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.02em;
}

.kgpos-branding {
    background: var(--kgpos-gold);
    color: var(--kgpos-dark);
    padding: 0.375rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Form Container */
.kgpos-form {
    padding: 1.5rem;
    background: #fafafa;
}

/* Section Titles */
.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #475569;
    margin: 0 0 1.25rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
    letter-spacing: -0.01em;
}

/* Spot Price Section */
.kgpos-spot-price-section {
    margin-bottom: 1.5rem;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
}

.spot-price-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.price-input-group {
    position: relative;
}

.price-input-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.375rem;
}

.spot-price-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    background: white;
}

.spot-price-input:hover {
    border-color: #cbd5e1;
}

.spot-price-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.price-per-gram {
    display: block;
    font-size: 0.75rem;
    color: var(--kgpos-text-light);
    margin-top: 0.25rem;
}

/* Customer Fields */
.kgpos-customer-fields {
    margin-bottom: 1.5rem;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
}

/* Field Groups */
.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.field-group {
    display: flex;
    flex-direction: column;
}


.field-group label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.375rem;
}

.field-group input,
.field-group select,
.field-group textarea {
    padding: 0.625rem 0.875rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    background: white;
}

.field-group input:hover,
.field-group select:hover,
.field-group textarea:hover {
    border-color: #cbd5e1;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.readonly-field {
    background: #f8fafc !important;
    cursor: not-allowed;
    color: #64748b;
}

.lookup-status {
    font-size: 0.8rem;
    margin-top: 0.375rem;
    display: block;
    height: 1.2rem;
    font-weight: 500;
}

.lookup-status.searching {
    color: #D4AF37;
}

.lookup-status.found {
    color: var(--kgpos-success);
}

.lookup-status.new {
    color: var(--kgpos-text-light);
}

/* Items Section */
.kgpos-items-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
}

.kgpos-items-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #475569;
    margin: 0 0 1.25rem 0;
}

.items-container {
    margin-bottom: 1rem;
}

.item-row {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    position: relative;
    transition: all 0.2s ease;
}

.item-row:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.item-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: end;
}

.item-fields .field-group {
    flex: 1 1 150px;
    min-width: 120px;
}

.item-fields .field-group:has(.quantity-input) {
    flex: 0 0 80px;
    min-width: 80px;
}


.radio-group {
    display: flex;
    gap: 0.75rem;
    padding: 0.375rem 0;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: normal;
    cursor: pointer;
    font-size: 0.875rem;
}

.radio-group input[type="radio"] {
    accent-color: var(--kgpos-gold);
}

.remove-row-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #ef4444;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.remove-row-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* Offer Display with Amount */
.offer-amount {
    font-size: 0.75rem;
    color: var(--kgpos-text-light);
    margin-left: 0.25rem;
}

/* Add Row Button */
.add-row-btn {
    background: linear-gradient(135deg, #D4AF37 0%, #f5d673 100%);
    color: #475569;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(212, 175, 55, 0.2);
}

.add-row-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(212, 175, 55, 0.3);
}

.add-row-btn:active {
    transform: translateY(0);
}

/* Total Section */
.total-section {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 0.875rem 1.25rem;
    border-radius: 8px;
    margin-top: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.total-section h3 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    display: flex;
    gap: 1rem;
    align-items: baseline;
}

.total-section h3 span {
    color: #D4AF37;
    font-size: 1rem;
}

.transaction-code {
    font-size: 0.85rem;
    opacity: 0.85;
}

.transaction-code span {
    font-weight: 600;
    color: #D4AF37;
    font-family: 'Courier New', monospace;
}

/* Customer Details Section */
.kgpos-customer-details {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--kgpos-border);
}

.kgpos-customer-details h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--kgpos-text);
    margin: 0 0 1rem 0;
}

.field-section {
    margin-bottom: 1.5rem;
}

.field-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--kgpos-text);
    margin: 0 0 0.75rem 0;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--kgpos-border);
}

.btn-next,
.btn-submit {
    background: linear-gradient(135deg, #D4AF37 0%, #f5d673 100%);
    color: #475569;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.btn-next:hover,
.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(212, 175, 55, 0.4);
}

.btn-next:active,
.btn-submit:active {
    transform: translateY(0);
}

.btn-submit {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-submit:hover {
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* Transaction Summary */
#transaction-summary {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--kgpos-shadow);
}

.summary-header {
    text-align: center;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--kgpos-gold);
}

.summary-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: var(--kgpos-dark);
}

.summary-section {
    margin-bottom: 1.5rem;
}

.summary-section h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--kgpos-dark);
    margin: 0 0 0.75rem 0;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 0.5rem;
}

.summary-label {
    font-weight: 500;
    color: var(--kgpos-text-light);
}

.summary-value {
    color: var(--kgpos-text);
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.75rem;
}

.summary-table th,
.summary-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--kgpos-border);
    font-size: 0.875rem;
}

.summary-table th {
    font-weight: 600;
    color: var(--kgpos-text-light);
    background: var(--kgpos-light);
}

.summary-total {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--kgpos-gold);
    text-align: right;
    font-size: 1.25rem;
    font-weight: 600;
}

.summary-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.print-btn,
.new-transaction-btn {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.print-btn {
    background: var(--kgpos-dark);
    color: white;
    border: none;
}

.new-transaction-btn {
    background: white;
    color: var(--kgpos-gold);
    border: 1px solid var(--kgpos-gold);
}

.print-btn:hover,
.new-transaction-btn:hover {
    opacity: 0.8;
}

/* Loading State */
.kgpos-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 1px solid rgba(212,175,55,0.3);
    border-top-color: var(--kgpos-gold);
    border-radius: 50%;
    animation: kgpos-spin 0.8s linear infinite;
}

@keyframes kgpos-spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .kgpos-calculator-wrapper {
        margin: 0.5rem;
        border-radius: 8px;
    }
    
    .kgpos-header {
        padding: 1.25rem 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .kgpos-header h2 {
        font-size: 1.25rem;
    }
    
    .kgpos-form {
        padding: 1.25rem;
    }
    
    .kgpos-spot-price-section,
    .kgpos-customer-fields,
    .kgpos-items-section {
        padding: 1rem;
    }
    
    .spot-price-inputs {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .field-row {
        grid-template-columns: 1fr;
    }
    
    .item-fields {
        grid-template-columns: 1fr;
    }
    
    .item-row {
        padding: 1rem;
        padding-top: 2.5rem;
    }
    
    .total-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1.25rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-next,
    .btn-submit {
        width: 100%;
        padding: 1rem;
    }
}

/* Hide dashicons on frontend if not loaded */
.dashicons:before {
    content: "×";
    font-family: inherit;
    font-size: 16px;
}

/* Custom Scrollbar */
.kgpos-calculator-wrapper ::-webkit-scrollbar {
    width: 6px;
}

.kgpos-calculator-wrapper ::-webkit-scrollbar-track {
    background: var(--kgpos-light);
}

.kgpos-calculator-wrapper ::-webkit-scrollbar-thumb {
    background: var(--kgpos-border);
    border-radius: 3px;
}

.kgpos-calculator-wrapper ::-webkit-scrollbar-thumb:hover {
    background: var(--kgpos-text-light);
}

/* Main Wrapper */
.kgpos-calculator-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--kgpos-bg);
    min-height: 100vh;
}

/* Header */
.kgpos-header {
    background: linear-gradient(135deg, var(--kgpos-secondary) 0%, #2d2d2d 100%);
    color: white;
    padding: 1.5rem;
    border-radius: var(--kgpos-radius) var(--kgpos-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--kgpos-shadow);
}

.kgpos-header h2 {
    margin: 0;
    font-size: 1.875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.kgpos-branding {
    background: var(--kgpos-primary);
    color: var(--kgpos-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Form Container */
.kgpos-form {
    background: var(--kgpos-card-bg);
    border-radius: 0 0 var(--kgpos-radius) var(--kgpos-radius);
    padding: 1.5rem;
    box-shadow: var(--kgpos-shadow);
}

/* Spot Price Display */
.kgpos-spot-price-display {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.spot-price-card {
    background: linear-gradient(135deg, var(--kgpos-accent) 0%, #FFF 100%);
    border: 1px solid var(--kgpos-primary);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.spot-price-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(212,175,55,0.2);
}

.metal-icon {
    font-size: 2.5rem;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.1));
}

.price-info h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--kgpos-text-light);
}

.price-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--kgpos-secondary);
    margin-bottom: 0.25rem;
}

.price-gram {
    font-size: 0.875rem;
    color: var(--kgpos-text-light);
}

.refresh-prices-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--kgpos-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    align-self: center;
}

.refresh-prices-btn:hover {
    background: var(--kgpos-secondary);
    transform: rotate(180deg);
}

.refresh-prices-btn .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

/* Customer Fields */
.kgpos-customer-fields {
    background: var(--kgpos-bg);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Field Groups */
.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.field-group {
    display: flex;
    flex-direction: column;
}


.field-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--kgpos-text);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-group input,
.field-group select,
.field-group textarea {
    padding: 0.75rem;
    border: 1px solid var(--kgpos-border);
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.3s ease;
    background: white;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    outline: none;
    border-color: var(--kgpos-primary);
    box-shadow: 0 0 0 3px rgba(212,175,55,0.1);
}

.readonly-field {
    background: #F3F4F6 !important;
    cursor: not-allowed;
    font-weight: 600;
}

.field-helper {
    font-size: 0.75rem;
    color: var(--kgpos-text-light);
    margin-top: 0.25rem;
    font-style: italic;
}

/* Items Section */
.kgpos-items-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--kgpos-bg);
    border-radius: 10px;
}

.kgpos-items-section h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--kgpos-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.items-container {
    margin-bottom: 1.5rem;
}

.item-row {
    background: white;
    border: 1px solid var(--kgpos-border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
    transition: all 0.3s ease;
}

.item-row:hover {
    border-color: var(--kgpos-primary);
    box-shadow: 0 4px 12px rgba(212,175,55,0.1);
}

.item-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    align-items: end;
}

.bullion-fields {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.radio-group {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: normal;
    text-transform: uppercase; letter-spacing: 0.025em;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    accent-color: var(--kgpos-primary);
}

.remove-row-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--kgpos-danger);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remove-row-btn:hover {
    background: #DC2626;
    transform: scale(1.1);
}

/* Add Row Button */
.add-row-btn {
    background: var(--kgpos-primary);
    color: var(--kgpos-secondary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.add-row-btn:hover {
    background: var(--kgpos-secondary);
    color: var(--kgpos-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Total Section */
.total-section {
    background: linear-gradient(135deg, var(--kgpos-secondary) 0%, #2d2d2d 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
    margin-top: 2rem;
    text-align: center;
}

.total-section h3 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

.total-section h3 span {
    color: var(--kgpos-primary);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.transaction-code {
    margin-top: 0.5rem;
    font-size: 0.9375rem;
    opacity: 0.9;
}

.transaction-code span {
    font-weight: 600;
    color: var(--kgpos-primary);
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* Customer Details Section */
.kgpos-customer-details {
    background: var(--kgpos-bg);
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.kgpos-customer-details h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--kgpos-secondary);
}

.field-section {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--kgpos-border);
}

.field-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--kgpos-primary);
    border-bottom: 2px solid var(--kgpos-accent);
    padding-bottom: 0.5rem;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--kgpos-border);
}

.btn-next,
.btn-submit {
    background: var(--kgpos-primary);
    color: var(--kgpos-secondary);
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-next:hover,
.btn-submit:hover {
    background: var(--kgpos-secondary);
    color: var(--kgpos-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.btn-submit {
    background: var(--kgpos-success);
    color: white;
}

.btn-submit:hover {
    background: #059669;
}

/* Transaction Summary */
#transaction-summary {
    background: white;
    border-radius: var(--kgpos-radius);
    padding: 1.5rem;
    margin-top: 2rem;
    box-shadow: var(--kgpos-shadow);
}

.summary-header {
    background: linear-gradient(135deg, var(--kgpos-primary) 0%, #B8941F 100%);
    color: var(--kgpos-secondary);
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    text-align: center;
}

.summary-header h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.summary-section {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--kgpos-bg);
    border-radius: 10px;
}

.summary-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--kgpos-primary);
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
}

.summary-table th,
.summary-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--kgpos-border);
}

.summary-table th {
    font-weight: 600;
    color: var(--kgpos-text-light);
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.summary-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.print-btn,
.new-transaction-btn {
    background: var(--kgpos-primary);
    color: var(--kgpos-secondary);
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.print-btn:hover,
.new-transaction-btn:hover {
    background: var(--kgpos-secondary);
    color: var(--kgpos-primary);
    transform: translateY(-2px);
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.status-new {
    background: #DBEAFE;
    color: #1E40AF;
}

.status-badge.status-well-known {
    background: #D1FAE5;
    color: #065F46;
}

.status-badge.status-suspicious {
    background: #FEE2E2;
    color: #991B1B;
}

/* Loading State */
.kgpos-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(212,175,55,0.3);
    border-top-color: var(--kgpos-primary);
    border-radius: 50%;
    animation: kgpos-spin 1s linear infinite;
}

@keyframes kgpos-spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .kgpos-calculator-wrapper {
        padding: 1rem;
    }
    
    .kgpos-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .kgpos-spot-price-display {
        grid-template-columns: 1fr;
    }
    
    .field-row {
        grid-template-columns: 1fr;
    }
    
    .item-fields {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-next,
    .btn-submit {
        width: 100%;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.item-row {
    animation: fadeIn 0.3s ease;
}

/* Custom Scrollbar */
.kgpos-calculator-wrapper ::-webkit-scrollbar {
    width: 10px;
}

.kgpos-calculator-wrapper ::-webkit-scrollbar-track {
    background: var(--kgpos-bg);
    border-radius: 10px;
}

.kgpos-calculator-wrapper ::-webkit-scrollbar-thumb {
    background: var(--kgpos-primary);
    border-radius: 10px;
}

.kgpos-calculator-wrapper ::-webkit-scrollbar-thumb:hover {
    background: var(--kgpos-secondary);
}

/* Age Validation Styles */
input#dob.error {
    border-color: #dc2626;
    background-color: #fef2f2;
}

.age-validation-message {
    display: block;
    color: #dc2626;
    font-size: 13px;
    margin-top: 4px;
    font-weight: 500;
}

input.error {
    border-color: #dc2626 !important;
    background-color: #fef2f2 !important;
}

/* Better Date Input Styling */
input[type="date"] {
    position: relative;
    padding-right: 10px;
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    font-size: 18px;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Show placeholder-like text for empty date fields */
input[type="date"]:not(:focus):invalid {
    color: #9ca3af;
}
/* Modern Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.item-row {
    animation: fadeIn 0.3s ease-out;
}

/* Focus visible for accessibility */
*:focus-visible {
    outline: 2px solid #D4AF37;
    outline-offset: 2px;
}

/* Improve select dropdowns appearance */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23000000' d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px;
    padding-right: 2.5rem !important;
    cursor: pointer;
}

/* Improved disabled state */
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Add subtle hover effect to form sections */
.kgpos-spot-price-section:hover,
.kgpos-customer-fields:hover,
.kgpos-items-section:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s ease;
}

/* Better placeholder styling */
::placeholder {
    color: #94a3b8;
    opacity: 1;
}

/* Smooth transitions for all interactive elements */
button, input, select, textarea {
    transition: all 0.2s ease;
}

/* Fix bullion/sales item grid layout */
.bullion-fields {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 1rem;
    align-items: end;
}


/* Form Container - Much Less Padding */
.kgpos-form {
    padding: 1rem !important;
    background: #fafafa !important;
}

/* Section Titles - Minimal */
.section-title {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: #64748b !important;
    margin: 0 0 0.75rem 0 !important;
    padding-bottom: 0.375rem !important;
    border-bottom: 1px solid #e5e7eb !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
}

/* Spot Price Section - Compact */
.kgpos-spot-price-section {
    margin-bottom: 1rem !important;
    background: white !important;
    padding: 1rem !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    border: 1px solid #e5e7eb !important;
}

.spot-price-inputs {
    gap: 0.75rem !important;
}

.price-input-group label {
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    color: #64748b !important;
    margin-bottom: 0.25rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

.spot-price-input {
    padding: 0.5rem 0.75rem !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 4px !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
}

.spot-price-input:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1) !important;
}

/* Customer Fields - Compact */
.kgpos-customer-fields {
    margin-bottom: 1rem !important;
    background: white !important;
    padding: 1rem !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    border: 1px solid #e5e7eb !important;
}

/* Field Groups - Minimal Spacing */
.field-row {
    gap: 0.75rem !important;
    margin-bottom: 0.75rem !important;
}

.field-group label {
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    color: #64748b !important;
    margin-bottom: 0.25rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

.field-group input,
.field-group select,
.field-group textarea {
    padding: 0.5rem 0.75rem !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 4px !important;
    font-size: 0.875rem !important;
    font-weight: 400 !important;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1) !important;
}

/* Items Section - Minimal */
.kgpos-items-section {
    margin-top: 1rem !important;
    padding: 1rem !important;
    border-radius: 6px !important;
    box-shadow: none !important;
}

.kgpos-items-section h3 {
    font-size: 0.75rem !important;
    color: #64748b !important;
    margin: 0 0 0.75rem 0 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

.item-row {
    background: #fafafa !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 4px !important;
    padding: 0.75rem !important;
    margin-bottom: 0.75rem !important;
}

.item-fields {
    gap: 0.75rem !important;
}

/* Buttons - Sleeker */
.kgpos-button,
.button-primary,
.add-item-btn {
    padding: 0.5rem 1rem !important;
    font-size: 0.8125rem !important;
    border-radius: 4px !important;
    font-weight: 500 !important;
}

.remove-item {
    padding: 0.375rem 0.625rem !important;
    font-size: 0.75rem !important;
}

/* Summary Section - Compact */
.kgpos-summary {
    padding: 1rem !important;
    border-radius: 6px !important;
    margin-top: 1rem !important;
}

.summary-row {
    padding: 0.375rem 0 !important;
    font-size: 0.875rem !important;
}

.summary-row.total {
    padding-top: 0.5rem !important;
    margin-top: 0.5rem !important;
    font-size: 1rem !important;
}

/* FIX: Remove X icon from Add Row button */
.add-row-btn .dashicons-dismiss,
.add-row-btn::before {
    display: none !important;
}

.add-row-btn {
    padding: 0.5rem 1rem !important;
    font-size: 0.8125rem !important;
}

/* FIX: Improved Summary Section Layout */
.total-section {
    padding: 1rem 1.25rem !important;
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 1.5rem !important;
    align-items: center !important;
}

.total-section h3 {
    font-size: 0.875rem !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 1.5rem !important;
    margin: 0 !important;
}

.total-section h3 > div {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.total-section h3 span {
    font-size: 1.125rem !important;
    font-weight: 700 !important;
}

.transaction-code {
    font-size: 0.75rem !important;
    white-space: nowrap !important;
    text-align: right !important;
}

/* FIX: Better label styling */
.field-group label {
    font-size: 0.6875rem !important;
    color: #64748b !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

/* FIX: Description field styling */
.field-group label[for*="description"] {
    color: #94a3b8 !important;
    font-weight: 500 !important;
}

/* FIX: Offer dropdown styling */
select.offer-select {
    font-weight: 500 !important;
    color: #1e293b !important;
}

select.offer-select option {
    padding: 0.5rem !important;
}

/* FIX: Summary section better layout - override inline styles */
.total-section > div[style] {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 1rem !important;
    align-items: center !important;
}

.total-section h3[style] {
    margin: 0 !important;
    font-size: 0.9375rem !important;
}

#bullion-breakdown {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 1.25rem !important;
    font-size: 0.8125rem !important;
}

#bullion-breakdown > div {
    display: flex;
    align-items: baseline;
    gap: 0.375rem;
}

#bullion-breakdown strong {
    font-weight: 600;
    color: #D4AF37;
}

.total-section {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 1rem !important;
}

/* HIDE all dashicons in Add Row button */
.add-row-btn .dashicons,
.add-row-btn span[class*="dashicons"] {
    display: none !important;
}

/* Hide transaction code completely */
.transaction-code {
    display: none !important;
}

/* Better placeholder/default option styling */
select option[value=""],
select option:disabled {
    color: #94a3b8 !important;
    font-style: italic;
}

select:invalid {
    color: #94a3b8 !important;
}

/* Improve select dropdown appearance */
.field-group select {
    color: #1e293b !important;
}

.field-group select:not(:valid) {
    color: #94a3b8 !important;
}

/* FIX: Section title consistency - make them match field labels */
.section-title {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: #64748b !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

/* FIX: TOTAL label readability in summary bar */
.total-section h3 {
    color: white !important;
}

.total-section .grand-total {
    color: white !important;
}

/* Remove "TOTAL:" text, just show the amount */
.total-section h3::before {
    content: none !important;
}

/* Make sure total amount is visible */
#scrap-total,
#bullion-grand-total,
#sales-grand-total,
.total-section h3 span {
    color: #D4AF37 !important;
    font-weight: 700 !important;
}

/* Better placeholder styling */
input::placeholder,
textarea::placeholder {
    color: #cbd5e1 !important;
    opacity: 1 !important;
}

/* Tighter section spacing */
.kgpos-customer-fields,
.kgpos-items-section,
.kgpos-spot-price-section {
    margin-bottom: 1rem !important;
}

/* Remove extra "TOTAL:" text before amount */
.total-section h3 {
    font-size: 0.875rem !important;
    font-weight: 400 !important;
}

.total-section h3 span {
    font-size: 1.25rem !important;
    margin-left: 0.5rem !important;
}

/* FIX: Make input fields VISIBLE with clear borders */
.field-group input,
.field-group select,
.field-group textarea,
.spot-price-input {
    border: 1px solid #d1d5db !important;
    background: white !important;
}

.field-group input:hover,
.field-group select:hover,
.field-group textarea:hover,
.spot-price-input:hover {
    border-color: #9ca3af !important;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus,
.spot-price-input:focus {
    border-color: #3b82f6 !important;
    outline: none !important;
}

/* Ensure all form inputs are visible */
input[type="text"],
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
    border: 1px solid #d1d5db !important;
    background: white !important;
}

/* FIX: Better field sizing - QTY field too small */
.item-fields .field-group {
    flex: 1 1 auto !important;
    min-width: 140px !important;
}

/* QTY field should be smaller but not TOO small */
.item-fields .field-group:has(input[name*="quantity"]),
.item-fields .field-group:has(.quantity-input) {
    flex: 0 0 100px !important;
    min-width: 100px !important;
}

/* Metal and Type fields */
.item-fields .field-group:has(select[name*="metal"]),
.item-fields .field-group:has(select[name*="type"]) {
    flex: 1 1 160px !important;
    min-width: 140px !important;
}

/* Weight, Purity, Offer fields */
.item-fields .field-group:has(select[name*="weight"]),
.item-fields .field-group:has(select[name*="purity"]),
.item-fields .field-group:has(select[name*="offer"]) {
    flex: 1 1 180px !important;
    min-width: 160px !important;
}

/* Description field - full width */
.item-fields .field-group:has(input[name*="description"]),
.item-fields .field-group:has(textarea) {
    flex: 1 1 100% !important;
    width: 100% !important;
}

/* Better input sizing overall */
.item-fields {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.75rem !important;
    align-items: flex-end !important;
}

/* REMOVE padding from calculator wrapper */
.kgpos-calculator-wrapper {
    padding: 0 !important;
    margin: 0 auto !important;
}

/* Make item row background white */
.item-row {
    background: white !important;
}

/* Header h2 size to 22px */
.kgpos-header h2 {
    font-size: 22px !important;
}

/* FIX: Scrap Gold Summary Layout */
.scrap-summary {
    display: flex !important;
    align-items: center !important;
    gap: 1.5rem !important;
    flex-wrap: wrap !important;
}

.scrap-amount,
#scrap-total {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: #D4AF37 !important;
}

.scrap-divider {
    color: rgba(255, 255, 255, 0.3) !important;
    font-size: 1.25rem !important;
}

.scrap-weight {
    font-size: 0.875rem !important;
    color: rgba(255, 255, 255, 0.9) !important;
    display: flex !important;
    align-items: baseline !important;
    gap: 0.375rem !important;
}

#scrap-total-weight {
    font-weight: 600 !important;
    color: white !important;
    font-size: 1rem !important;
}


/* Customer Information Section - All fields in one row */
.kgpos-customer-fields .field-row {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
    gap: 0.75rem !important;
    margin-bottom: 0.75rem !important;
}

/* Make both rows display inline */
.kgpos-customer-fields {
    display: grid !important;
    grid-template-columns: 1fr !important;
}

/* Combine into single visual row */
.kgpos-customer-fields .field-row:first-of-type {
    margin-bottom: 0 !important;
}

.kgpos-customer-fields .field-row:last-of-type {
    margin-top: 0 !important;
}

/* COMPLETE REDESIGN - Item Fields Auto-Adjust in One Row */
.item-fields {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 0.75rem !important;
    align-items: flex-end !important;
    width: 100% !important;
}

/* Let each field take its natural width */
.item-fields .field-group {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
}

/* Metal and Type fields */
.item-fields .field-group:has(select[name*="metal"]),
.item-fields .field-group:has(select[name*="type"]) {
    flex: 1 1 100px !important;
    min-width: 100px !important;
}

/* QTY field - smallest */
.item-fields .field-group:has(.quantity-input) {
    flex: 0 0 70px !important;
}

/* Weight field */
.item-fields .field-group:has(.weight-select) {
    flex: 0 0 140px !important;
}

/* Purity field */
.item-fields .field-group:has(.purity-select) {
    flex: 0 0 120px !important;
}

/* Offer field */
.item-fields .field-group:has(.offer-select),
.item-fields .field-group:has(.markup-select) {
    flex: 0 0 130px !important;
}

/* Description field - takes remaining space */
.item-fields .field-group:has(.description-input) {
    flex: 1 1 auto !important;
    min-width: 150px !important;
}

/* Input fields fill their containers */
.item-fields .field-group input,
.item-fields .field-group select {
    width: 100% !important;
}