/**
 * Cap Quote Builder Styles
 * Professional styling for cap embroidery quote builder
 * NWCA Green theme (#4cb354)
 */

/* Root Variables */
:root {
    --primary-color: #4cb354;
    --primary-dark: #409a47;
    --primary-light: #5bc85f;
    --secondary-color: #f5f7fa;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Base Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--secondary-color);
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Size Matrix Container */
.size-matrix {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--secondary-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.size-matrix h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* Size Input Styles - Matching Embroidery Builder */
.size-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.size-input-group {
    text-align: center;
}

.size-input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.size-qty-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
    font-size: 1rem;
}

.size-qty-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76, 179, 84, 0.2);
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    margin-top: 80px; /* Account for fixed header */
}

/* Page Title */
.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.page-title i {
    color: var(--primary-color);
    font-size: 2.2rem;
}

.page-description {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Phase Navigation */
.phase-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
    padding: 0 2rem;
}

.phase-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
    position: relative;
}

.phase-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.phase-step-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    text-align: center;
    transition: all 0.3s ease;
}

.phase-step.active .phase-step-number {
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.phase-step.active .phase-step-label {
    color: var(--primary-color);
    font-weight: 600;
}

.phase-connector {
    flex: 1;
    height: 2px;
    background-color: #e5e7eb;
    margin: 0 1rem;
    position: relative;
    top: -20px;
}

/* Phase Sections */
.phase-section {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin: 2rem 0;
    overflow: hidden;
}

.phase-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
}

.phase-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.phase-number {
    background: rgba(255, 255, 255, 0.2);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.phase-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 1rem;
}

/* Phase Content */
.phase-section > div:not(.phase-header) {
    padding: 2rem;
}

/* Logo Sections */
.front-logo-section {
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    background: rgba(76, 179, 84, 0.05);
}

.logo-header {
    margin-bottom: 1rem;
}

.logo-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-header .text-primary {
    color: var(--primary-color);
}

.logo-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

/* Additional Logos */
.additional-logos-container {
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
    margin-top: 2rem;
}

.additional-logos-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.additional-logos-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0 0 1rem 0;
}

.additional-logo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    background: white;
}

.logo-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    color: var(--text-primary);
}

.logo-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.logo-actions {
    display: flex;
    gap: 0.5rem;
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-control,
.form-select,
.form-textarea {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 179, 84, 0.1);
}

.form-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Checkbox Styles */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.875rem;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 0.5rem;
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

/* Product Search */
.product-search-container {
    background: var(--secondary-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.search-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.suggestions-dropdown {
    position: relative;
    z-index: 10;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    margin-top: 0.25rem;
}

.suggestion-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
}

.suggestion-item:hover {
    background-color: var(--secondary-color);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.autocomplete-note {
    background: #f0f9ff;
    color: #0369a1;
    padding: 0.5rem;
    font-size: 0.75rem;
    border-bottom: 1px solid #e0e7ff;
}

.no-results,
.error {
    padding: 1rem;
    text-align: center;
    font-style: italic;
}

.error {
    color: var(--danger-color);
}

/* Product Display */
.product-display {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.product-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.product-info img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.product-details h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
}

.product-details p {
    color: var(--text-secondary);
    margin: 0;
}

/* Size Matrix */
.size-matrix h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
}

.size-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.size-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.size-input-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.size-qty-input {
    width: 60px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
    font-size: 0.875rem;
}

.total-row {
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
    font-weight: 600;
    text-align: center;
}

/* Products List */
.products-list {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
    border: 1px solid var(--border-color);
}

.products-list h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

.product-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    background: var(--secondary-color);
}

.product-item-image img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.product-item-info {
    flex: 1;
}

.product-item-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
}

.product-item-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0.25rem 0;
}

.sizes {
    font-weight: 500;
    color: var(--text-primary);
}

.quantity {
    color: var(--primary-color);
}

.aggregate-total {
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    margin-top: 1rem;
}

.tier-indicator {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-left: 0.5rem;
}

/* Quote Summary */
.quote-summary {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.quote-header {
    text-align: center;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

/* Pricing Breakdown Styles */
.line-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin: 0.5rem 0;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.line-item:last-child {
    border-bottom: none;
}

.ltm-breakdown {
    flex: 1;
    margin: 0 1rem;
    font-size: 0.9em;
    color: #666;
    line-height: 1.6;
}

.additional-logos-line {
    display: inline-block;
    margin-left: 0.5rem;
    color: #4169E1;
    font-weight: 500;
}

.line-total {
    font-weight: bold;
    white-space: nowrap;
}

.product-lines {
    margin: 1rem 0;
    padding: 0.5rem 0;
}

.product-subtotal {
    text-align: right;
    font-weight: bold;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
}

.quote-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 0.5rem 0;
}

.logos-section,
.products-section {
    margin-bottom: 2rem;
}

.logos-section h4,
.products-section h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

.logos-summary {
    background: var(--secondary-color);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
}

.product-summary {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.product-summary h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.pricing-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.pricing-table th,
.pricing-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.pricing-table th {
    background: var(--secondary-color);
    font-weight: 600;
    color: var(--text-primary);
}

.product-total {
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
}

.quote-totals {
    border-top: 2px solid var(--border-color);
    padding-top: 1rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

.grand-total {
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
    font-size: 1.125rem;
}

.grand-total span {
    font-weight: 700;
    color: var(--primary-color);
}

.ltm-note {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.875rem;
    color: #92400e;
    margin-top: 1rem;
}

/* Customer Information */
.customer-info-section {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.customer-info-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn.success {
    background-color: var(--success-color);
}

/* Phase Actions */
.phase-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--secondary-color);
    border-top: 1px solid var(--border-color);
    gap: 1rem;
}

.phase-actions .btn {
    min-width: 120px;
    justify-content: center;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header.success {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    border-bottom: none;
}

.modal-header h2,
.modal-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: inherit;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--primary-color);
}

.loading-spinner p {
    margin: 0;
    color: var(--text-primary);
    font-weight: 500;
}

/* Error Banner */
.error-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    color: white;
    padding: 1rem;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
}

.error-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1200px;
    width: 100%;
    justify-content: center;
}

.error-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    margin-left: 1rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.error-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Empty Messages */
.empty-message {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 2rem;
}

/* Totals Section Styling */
.totals-section {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-dark) !important;
}

.totals-section h4 {
    color: white !important;
}

.totals-section h4 i {
    color: white !important;
}

.totals-section p {
    color: white !important;
}

.totals-breakdown {
    space-y: 0.5rem;
}

.total-line {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: white !important;
}

.total-line:last-child {
    border-bottom: none;
}

.ltm-line {
    color: rgba(255, 255, 255, 0.9) !important;
    font-style: italic;
}

.grand-total {
    font-size: 1.25rem;
    font-weight: bold;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    color: white !important;
}

.grand-total span {
    color: white !important;
}

.grand-total strong {
    color: white !important;
}

/* Additional Services Styling */
.additional-service-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin: 0.5rem 0;
}

.service-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.service-name {
    font-weight: 600;
    color: var(--text-primary);
}

.service-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.service-total {
    font-weight: bold;
    color: var(--primary-color);
}

.badge-additional {
    background: #6c757d;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
        margin-top: 60px;
    }
    
    .page-title {
        font-size: 2rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .phase-nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .phase-connector {
        display: none;
    }
    
    .search-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .product-info {
        flex-direction: column;
        text-align: center;
    }
    
    .product-item {
        flex-direction: column;
        text-align: center;
    }
    
    .phase-actions {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .size-inputs {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .phase-nav,
    .phase-actions,
    .btn,
    .modal,
    .loading-overlay,
    .error-banner {
        display: none !important;
    }
    
    .phase-section {
        box-shadow: none;
        border: 1px solid #ccc;
        margin: 1rem 0;
    }
    
    .quote-summary {
        border: 2px solid var(--primary-color);
    }
}

/* Animation Utilities */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}