/* ===========================
   Frontend Order & Proposal Creator PRO
   Version: 28.0
   Professional Design - Clean & Modern
   =========================== */

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

/* Container */
.foi-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

/* Header Section */
.foi-header-section {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.foi-main-title {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.foi-subtitle {
    font-size: 16px;
    color: #7f8c8d;
}

/* Form Container */
.foi-professional-form {
    background: white;
}

/* Card Styles */
.foi-card {
    background: white;
    margin-bottom: 20px;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.foi-card-title {
    background: #ef5e5e;
    color: white;
    padding: 15px 20px;
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    text-transform: none;
    letter-spacing: 0.3px;
}

.foi-card-content {
    padding: 25px;
    background: #fafbfc;
}

/* Field Layout */
.foi-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 18px;
}

.foi-field-row:last-child {
    margin-bottom: 0;
}

.foi-field-row-single {
    grid-template-columns: 1fr;
}

.foi-field-group {
    display: flex;
    flex-direction: column;
}

.foi-flex-2 {
    grid-column: span 2;
}

/* Labels */
.foi-label {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    display: block;
}

.foi-required {
    color: #e74c3c;
    margin-left: 3px;
    font-weight: 700;
}

/* Input Fields */
.foi-input {
    width: 100%;
    padding: 11px 15px;
    border: 1px solid #dcdde1;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
    color: #2c3e50;
}

.foi-input:focus {
    outline: none;
    border-color: #ef5e5e;
    box-shadow: 0 0 0 3px rgba(239, 94, 94, 0.1);
}

.foi-input::placeholder {
    color: #95a5a6;
}

/* Buttons */
.foi-button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.foi-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.foi-button-icon {
    font-size: 16px;
    line-height: 1;
}

.foi-button-success {
    background: #26c281;
    color: white;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.foi-button-success:hover:not(:disabled) {
    background: #1fa56e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(38, 194, 129, 0.3);
}

.foi-button-submit {
    width: 100%;
    padding: 16px;
    font-size: 15px;
    background: #ef5e5e;
    color: white;
    margin-top: 20px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.8px;
}

.foi-button-submit:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 94, 94, 0.35);
}

.foi-field-button {
    justify-content: flex-end;
}

.foi-field-button .foi-label {
    margin-bottom: 0;
}

.foi-field-button .foi-button {
    margin-top: auto;
}

/* Search Wrapper */
.foi-search-wrapper {
    position: relative;
}

.foi-search-input {
    width: 100%;
}

.foi-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dcdde1;
    border-top: none;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    display: none;
}

.foi-search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f1f3;
}

.foi-search-result-item:last-child {
    border-bottom: none;
}

.foi-search-result-item:hover {
    background: #f8f9fa;
}

.foi-result-name {
    color: #2c3e50;
    font-weight: 500;
    font-size: 14px;
}

.foi-result-price {
    color: #ef5e5e;
    font-weight: 600;
    font-size: 14px;
}

.foi-no-results {
    padding: 16px;
    text-align: center;
    color: #7f8c8d;
    font-size: 14px;
}

/* Selected Product Badge */
.foi-selected-product {
    margin-top: 12px;
    display: none;
}

.foi-selected-badge {
    background: #d1f2eb;
    border: 2px solid #26c281;
    border-radius: 6px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.foi-check-icon {
    background: #26c281;
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    font-size: 16px;
}

.foi-selected-text {
    flex: 1;
    color: #0e6655;
    font-size: 14px;
    font-weight: 500;
}

.foi-clear-selection {
    background: #e74c3c;
    color: white;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    line-height: 1;
}

.foi-clear-selection:hover {
    background: #c0392b;
    transform: rotate(90deg);
}

/* Cart Summary */
#cart-summary {
    margin-top: 20px;
}

.foi-summary-card {
    background: white;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.foi-summary-header {
    background: #2c3e50;
    color: white;
    padding: 15px 20px;
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.foi-summary-table-wrapper {
    background: white;
    padding: 0;
    overflow-x: auto;
}

.foi-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: white;
}

.foi-summary-table thead {
    background: #f8f9fa;
}

.foi-summary-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #ecf0f1;
}

.foi-summary-table tbody tr {
    border-bottom: 1px solid #ecf0f1;
    transition: background 0.2s ease;
}

.foi-summary-table tbody tr:hover {
    background: #f8f9fa;
}

.foi-summary-table tbody tr:last-child {
    border-bottom: none;
}

.foi-summary-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: #2c3e50;
    vertical-align: middle;
}

.foi-product-name {
    font-weight: 600;
    color: #2c3e50;
}

.foi-qty {
    text-align: center;
    font-weight: 600;
    color: #34495e;
}

.foi-price {
    font-weight: 500;
    color: #7f8c8d;
}

.foi-total {
    font-weight: 700;
    color: #ef5e5e;
}

.foi-action {
    text-align: center;
}

.foi-remove-item {
    background: white;
    border: 1.5px solid #ef5e5e;
    color: #ef5e5e;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.foi-remove-item:hover {
    background: #ef5e5e;
    color: white;
    transform: scale(1.05);
}

.foi-remove-item svg {
    display: block;
}

/* Summary Totals */
.foi-summary-totals {
    background: #fafbfc;
    padding: 20px 25px;
    border-top: 2px solid #ecf0f1;
}

.foi-subtotal-row,
.foi-grandtotal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 15px;
}

.foi-subtotal-row {
    color: #7f8c8d;
    border-bottom: 1px solid #ecf0f1;
    margin-bottom: 10px;
    padding-bottom: 12px;
}

.foi-subtotal-row span:first-child {
    font-weight: 600;
}

.foi-grandtotal-row {
    color: #2c3e50;
    font-weight: 700;
    font-size: 17px;
    background: #d1f2eb;
    padding: 14px 18px;
    border-radius: 6px;
    margin: 0;
}

.foi-amount {
    font-weight: 700;
    color: #ef5e5e;
}

.foi-grandtotal-row .foi-amount {
    color: #26c281;
    font-size: 19px;
}

/* Messages */
#messages {
    margin-top: 30px;
}

.foi-success-message,
.foi-error-message {
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.foi-success-message {
    background: linear-gradient(135deg, #d1f2eb 0%, #a8e6cf 100%);
    border: 2px solid #26c281;
    color: #0e6655;
}

.foi-error-message {
    background: linear-gradient(135deg, #fadbd8 0%, #f8b4b4 100%);
    border: 2px solid #e74c3c;
    color: #921e1e;
}

.foi-success-icon {
    background: #26c281;
    color: white;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    margin: 0 auto 20px;
    box-shadow: 0 4px 12px rgba(38, 194, 129, 0.3);
}

.foi-success-message h3 {
    color: #0e6655;
    margin-bottom: 16px;
    font-size: 24px;
    text-align: center;
    font-weight: 700;
}

.foi-success-message p {
    margin: 10px 0;
    font-size: 15px;
    text-align: center;
}

.foi-credentials-box {
    background: white;
    border: 2px solid #26c281;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.foi-credentials-box p {
    text-align: left;
    margin: 8px 0;
}

.foi-credentials-box code {
    background: #fff3cd;
    color: #856404;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.foi-note {
    color: #e74c3c;
    font-weight: 700;
    margin-top: 12px;
    text-align: left;
}

.foi-action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.foi-btn {
    padding: 14px 28px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 180px;
    font-size: 15px;
}

.foi-btn-primary {
    background: #ef5e5e;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 94, 94, 0.25);
}

.foi-btn-primary:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 94, 94, 0.35);
}

.foi-btn-success {
    background: #26c281;
    color: white;
    box-shadow: 0 4px 12px rgba(38, 194, 129, 0.25);
}

.foi-btn-success:hover {
    background: #1fa56e;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(38, 194, 129, 0.35);
}

.foi-btn-secondary {
    background: #7f8c8d;
    color: white;
    box-shadow: 0 4px 12px rgba(127, 140, 141, 0.25);
}

.foi-btn-secondary:hover {
    background: #5d6d6e;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(127, 140, 141, 0.35);
}

/* Responsive Design */
@media (max-width: 768px) {
    .foi-container {
        padding: 0 15px;
        margin: 20px auto;
    }
    
    .foi-field-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .foi-flex-2 {
        grid-column: span 1;
    }
    
    .foi-card-content {
        padding: 20px;
    }
    
    .foi-action-buttons {
        flex-direction: column;
    }
    
    .foi-btn {
        width: 100%;
        min-width: auto;
    }
    
    .foi-summary-table {
        font-size: 12px;
    }
    
    .foi-summary-table th,
    .foi-summary-table td {
        padding: 10px 8px;
    }
    
    .foi-product-name {
        font-size: 13px;
    }
    
    .foi-remove-item {
        width: 28px;
        height: 28px;
    }
    
    .foi-main-title {
        font-size: 26px;
    }
    
    .foi-subtitle {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .foi-summary-table th,
    .foi-summary-table td {
        padding: 8px 6px;
        font-size: 11px;
    }
    
    .foi-button {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .foi-input {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Print Styles */
@media print {
    .foi-button,
    .foi-remove-item,
    .foi-clear-selection {
        display: none;
    }
    
    .foi-container {
        max-width: 100%;
    }
    
    .foi-card {
        box-shadow: none;
        page-break-inside: avoid;
    }
}

/* Smooth Transitions */
.foi-input,
.foi-button,
.foi-search-result-item,
.foi-summary-table tbody tr,
.foi-remove-item,
.foi-clear-selection {
    transition: all 0.2s ease;
}

/* Focus Visible for Accessibility */
.foi-button:focus-visible,
.foi-input:focus-visible,
.foi-remove-item:focus-visible {
    outline: 2px solid #ef5e5e;
    outline-offset: 2px;
}

/* Loading States */
.foi-button.foi-loading {
    position: relative;
    color: transparent;
}

.foi-button.foi-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: foi-spinner 0.6s linear infinite;
}

@keyframes foi-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Custom Scrollbar */
.foi-search-results::-webkit-scrollbar {
    width: 8px;
}

.foi-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.foi-search-results::-webkit-scrollbar-thumb {
    background: #ef5e5e;
    border-radius: 4px;
}

.foi-search-results::-webkit-scrollbar-thumb:hover {
    background: #dc2626;
}