/* Import hybrid integration styles */
@import url('hybrid.css');

/* Main styles for Kanva Calculator - Updated with Activity Panel and Multi-Product Support */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 15px;
    background-color: #f8f9fa;
}

/* Activity Panel Mode - Compact for CRM sidebar */
.activity-panel-mode {
    padding: 0;
    margin: 0;
    background-color: white;
    min-height: 100vh;
}

.activity-panel-calculator {
    background: white;
    padding: 12px;
    margin: 0;
    border: none;
    box-shadow: none;
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #93D500;
}

.activity-header h3 {
    margin: 0;
    color: #17351A;
    font-size: 16px;
}

.launch-modal-btn {
    background: linear-gradient(135deg, #93D500 0%, #7ab300 100%);
    color: #17351A;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(147, 213, 0, 0.3);
}

.launch-modal-btn:hover {
    background: linear-gradient(135deg, #7ab300 0%, #93D500 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(147, 213, 0, 0.4);
}

.quick-product-section {
    margin-bottom: 15px;
}

.quick-product-section .input-group {
    flex-direction: column;
    margin-bottom: 10px;
    gap: 4px;
}

.quick-product-section .input-group label {
    min-width: auto;
    font-size: 12px;
    font-weight: bold;
    color: #17351A;
}

.quick-product-section .input-group input,
.quick-product-section .input-group select {
    padding: 6px;
    font-size: 12px;
    border: 1px solid #93D500;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

.quick-results {
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f5e8 100%);
    border: 1px solid #93D500;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 15px;
    font-size: 12px;
}

.quick-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quick-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quick-item.total {
    border-top: 1px solid #93D500;
    padding-top: 6px;
    margin-top: 6px;
    font-weight: bold;
    color: #17351A;
}

.quick-label {
    font-size: 11px;
    color: #666;
}

.quick-value {
    font-weight: bold;
    color: #17351A;
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    background: linear-gradient(135deg, #17351A 0%, #2e5c32 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: linear-gradient(135deg, #2e5c32 0%, #17351A 100%);
    transform: translateY(-1px);
}

/* Modal Mode - Larger sizing */
.modal-mode {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    min-height: 700px;
}

/* Left Navigation Mode - Full calculator without modal */
.left-nav-mode {
    padding: 20px;
    background-color: white;
    min-height: 100vh;
}

.left-nav-mode .calculator {
    background: white;
    box-shadow: none;
    border: none;
    padding: 0;
}

.left-nav-mode .input-group {
    margin-bottom: 18px;
}

.left-nav-mode .input-group label {
    min-width: 130px;
    font-size: 14px;
    color: #17351A;
}

.left-nav-mode .input-group input,
.left-nav-mode .input-group select {
    padding: 10px;
    font-size: 14px;
    border: 2px solid #93D500;
    border-radius: 6px;
}

.left-nav-mode .input-group input:focus,
.left-nav-mode .input-group select:focus {
    outline: none;
    border-color: #17351A;
    box-shadow: 0 0 0 3px rgba(147, 213, 0, 0.2);
}

.left-nav-mode .header h1 {
    font-size: 24px;
    color: #17351A;
}

.left-nav-mode .results {
    padding: 20px;
    margin: 20px 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f5e8 100%);
    border-left: 4px solid #93D500;
}

.calculator {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(23, 53, 26, 0.1);
    margin-bottom: 20px;
    border: 1px solid rgba(147, 213, 0, 0.2);
}

/* Sidebar Mode - Compact */
.sidebar-mode {
    padding: 10px;
    margin: 0;
}

.sidebar-mode .input-group {
    flex-direction: column;
    margin-bottom: 8px;
}

.sidebar-mode .input-group label {
    min-width: auto;
    margin-bottom: 3px;
    font-size: 11px;
    font-weight: bold;
    color: #17351A;
}

.sidebar-mode .input-group input,
.sidebar-mode .input-group select {
    padding: 6px;
    font-size: 12px;
    border: 1px solid #93D500;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

.sidebar-mode .input-group input:focus,
.sidebar-mode .input-group select:focus {
    outline: none;
    border-color: #17351A;
    box-shadow: 0 0 0 2px rgba(147, 213, 0, 0.2);
}

.sidebar-mode .results {
    padding: 10px;
    font-size: 12px;
    margin: 10px 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f5e8 100%);
    border-left: 3px solid #93D500;
}

.sidebar-mode .product-grid {
    display: none;
}

/* Product Mode Toggle */
.product-mode-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.mode-buttons {
    display: flex;
    gap: 8px;
}

.mode-btn {
    background: #f5f5f5;
    border: 1px solid #ddd;
    color: #666;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.mode-btn.active {
    background: linear-gradient(135deg, #93D500 0%, #7ab300 100%);
    color: #17351A;
    border-color: #93D500;
    font-weight: bold;
}

.mode-btn:hover:not(.active) {
    background: #e0e0e0;
}

/* Multi-Product Styles */
.multi-product-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f5e8 100%);
    border-radius: 8px;
    border: 1px solid rgba(147, 213, 0, 0.3);
}

.add-product-btn {
    background: linear-gradient(135deg, #93D500 0%, #7ab300 100%);
    color: #17351A;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(147, 213, 0, 0.3);
}

.add-product-btn:hover {
    background: linear-gradient(135deg, #7ab300 0%, #93D500 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(147, 213, 0, 0.4);
}

.product-lines {
    margin-bottom: 20px;
}

.product-line {
    background: white;
    border: 2px solid rgba(147, 213, 0, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.product-line:hover {
    border-color: #93D500;
    box-shadow: 0 4px 16px rgba(23, 53, 26, 0.1);
}

.product-line-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.product-line-header h4 {
    margin: 0;
    color: #17351A;
    font-size: 16px;
}

.remove-line-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.remove-line-btn:hover {
    background: #d32f2f;
    transform: translateY(-1px);
}

.product-line-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.line-item-summary {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4f4d4 100%);
    padding: 10px;
    border-radius: 6px;
    border: 1px solid rgba(147, 213, 0, 0.3);
}

.line-summary {
    font-size: 13px;
    color: #17351A;
}

.multi-product-results {
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f5e8 100%);
    border-left: 4px solid #93D500;
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(23, 53, 26, 0.1);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid rgba(147, 213, 0, 0.2);
}

.summary-label {
    font-weight: bold;
    color: #17351A;
}

.summary-value {
    color: #17351A;
    font-weight: bold;
}

.pricing-breakdown {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(147, 213, 0, 0.2);
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-total {
    border-top: 2px solid #93D500;
    margin-top: 10px;
    padding-top: 15px;
    font-size: 18px;
}

.breakdown-label {
    color: #17351A;
}

.breakdown-value {
    color: #17351A;
    font-weight: bold;
}

/* Tax Section */
.tax-section {
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f5e8 100%);
    border-radius: 8px;
    border: 1px solid rgba(147, 213, 0, 0.3);
}

.tax-section h4 {
    margin: 0 0 15px 0;
    color: #17351A;
    font-size: 16px;
}

.detect-tax-btn {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.3);
}

.detect-tax-btn:hover {
    background: linear-gradient(135deg, #1976d2 0%, #2196f3 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.4);
}

.header {
    text-align: center;
    color: #17351A;
    margin-bottom: 20px;
}

.header h1 {
    background: linear-gradient(135deg, #17351A 0%, #93D500 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

/* Customer Information Section */
.customer-info {
    margin-bottom: 20px;
}

.customer-info h3 {
    color: #17351A;
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 2px solid #93D500;
    padding-bottom: 5px;
}

/* Product Details Section */
.product-details {
    margin-bottom: 20px;
}

.product-details h3 {
    color: #17351A;
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 2px solid #93D500;
    padding-bottom: 5px;
}

.input-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group label {
    font-weight: bold;
    min-width: 120px;
    color: #17351A;
}

.input-group input, .input-group select {
    padding: 8px;
    border: 2px solid #93D500;
    border-radius: 6px;
    font-size: 14px;
    flex: 1;
    transition: all 0.3s ease;
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: #17351A;
    box-shadow: 0 0 0 3px rgba(147, 213, 0, 0.2);
}

/* Updated field styles for new field names */
#quoteName {
    font-weight: 600;
    color: #17351A;
}

#segment {
    text-transform: capitalize;
}

#emailDomain {
    position: relative;
}

#phone {
    font-family: monospace;
}

.results {
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f5e8 100%);
    border-left: 4px solid #93D500;
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(23, 53, 26, 0.1);
}

.results h3 {
    color: #17351A;
    margin-top: 0;
    font-size: 18px;
}

.tier-info {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4f4d4 100%);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid rgba(147, 213, 0, 0.3);
}

.copy-btn {
    background: linear-gradient(135deg, #93D500 0%, #7ab300 100%);
    color: #17351A;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    margin: 5px;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(147, 213, 0, 0.3);
}

.copy-btn:hover {
    background: linear-gradient(135deg, #7ab300 0%, #93D500 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(147, 213, 0, 0.4);
}

/* Admin Settings Button */
.admin-btn {
    background: linear-gradient(135deg, #17351A 0%, #2e5c32 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 10px;
    transition: all 0.3s ease;
}

.admin-btn:hover {
    background: linear-gradient(135deg, #2e5c32 0%, #17351A 100%);
    transform: translateY(-1px);
}

/* Actions Section */
.actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.product-card {
    border: 2px solid rgba(147, 213, 0, 0.2);
    border-radius: 12px;
    padding: 20px;
    background: linear-gradient(135deg, white 0%, #f8f9fa 100%);
    transition: all 0.3s ease;
}

.product-card:hover {
    border-color: #93D500;
    box-shadow: 0 4px 16px rgba(23, 53, 26, 0.1);
    transform: translateY(-2px);
}

.product-card h4 {
    color: #17351A;
    margin-top: 0;
    border-bottom: 2px solid #93D500;
    padding-bottom: 8px;
}

.pricing-tier {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 8px;
}

/* Updated tier colors using brand palette */
.tier1 { 
    background: linear-gradient(135deg, #ffebee 0%, #fce4ec 100%); 
    color: #d32f2f; 
    border: 1px solid #ffcdd2;
}
.tier2 { 
    background: linear-gradient(135deg, #fff3e0 0%, #fce4ec 100%); 
    color: #f57c00; 
    border: 1px solid #ffcc02;
}
.tier3 { 
    background: linear-gradient(135deg, #e8f5e8 0%, #d4f4d4 100%); 
    color: #17351A; 
    border: 1px solid #93D500;
}

/* Email Template Section */
.email-template {
    background: linear-gradient(135deg, white 0%, #f8f9fa 100%);
    border: 2px solid #93D500;
    border-radius: 12px;
    padding: 25px;
    margin-top: 20px;
    box-shadow: 0 4px 16px rgba(23, 53, 26, 0.1);
}

.email-template h3 {
    color: #17351A;
    border-bottom: 2px solid #93D500;
    padding-bottom: 8px;
    margin-top: 0;
}

.email-actions {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.email-templates {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.email-templates h4 {
    color: #17351A;
    margin-bottom: 10px;
}

.template-btn {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4f4d4 100%);
    color: #17351A;
    border: 1px solid #93D500;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    margin-right: 8px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.template-btn:hover {
    background: #93D500;
    color: white;
}

#emailOutput {
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f5e8 100%);
    padding: 20px;
    border-radius: 8px;
    border: 2px solid rgba(147, 213, 0, 0.2);
    max-height: 400px;
    overflow-y: auto;
    color: #17351A;
    line-height: 1.5;
}

/* Modal and responsive adjustments */
.modal-mode .calculator {
    min-height: 700px;
}

.modal-mode .input-group {
    margin-bottom: 20px;
}

.modal-mode .input-group label {
    min-width: 140px;
    font-size: 15px;
    color: #17351A;
}

.modal-mode .input-group input,
.modal-mode .input-group select {
    padding: 12px;
    font-size: 15px;
    border: 2px solid #93D500;
    border-radius: 6px;
}

.modal-mode .results {
    padding: 25px;
    margin: 25px 0;
}

.modal-mode .header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    color: #17351A;
}

.modal-mode .header p {
    font-size: 16px;
    margin-bottom: 30px;
    color: #4D5358;
}

/* Accent colors for important elements */
.total-amount {
    color: #17351A !important;
    font-weight: bold;
    background: linear-gradient(135deg, #e8f5e8 0%, #d4f4d4 100%);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #93D500;
}

/* Validation styles */
.input-group input.invalid,
.input-group select.invalid {
    border-color: #d32f2f;
    background: #ffebee;
}

.validation-error {
    color: #d32f2f;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* Loading states */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    font-size: 18px;
    color: #17351A;
}

/* Error container */
.error-container {
    background: #ffebee;
    border: 2px solid #d32f2f;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: #d32f2f;
}

.error-container h2 {
    margin-top: 0;
    color: #d32f2f;
}

.error-container button {
    background: #d32f2f;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 15px;
}

/* Responsive design */
@media (max-width: 768px) {
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-group label {
        min-width: auto;
        margin-bottom: 5px;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .email-actions {
        flex-direction: column;
    }
    
    .copy-btn {
        width: 100%;
        margin: 5px 0;
    }
    
    .modal-mode .input-group label {
        min-width: auto;
    }
    
    .product-line-fields {
        grid-template-columns: 1fr;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .mode-buttons {
        flex-direction: column;
        gap: 4px;
    }
    
    .multi-product-controls {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
}

/* Print styles */
@media print {
    .admin-btn,
    .actions,
    .email-actions,
    .email-templates,
    .mode-buttons,
    .add-product-btn,
    .remove-line-btn {
        display: none;
    }
    
    .calculator {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .results {
        background: #f0f0f0 !important;
        border-left: 4px solid #000 !important;
    }
}
