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

body {
    /* System font stack for fast loading and offline support */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: linear-gradient(180deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.logo-container {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.logo-container img {
    max-width: 150px;
    max-height: 60px;
    margin-bottom: 10px;
}

.logo-container h2 {
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.nav-menu {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 4px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    border-left-color: white;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    border-left-color: white;
    font-weight: 600;
}

.nav-item i {
    margin-right: 12px;
    font-size: 18px;
    width: 24px;
}

.footer {
    padding: 20px;
    text-align: center;
    font-size: 12px;
    opacity: 0.7;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Main Content */
.main-content {
    margin-left: 260px;
    padding: 30px;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 32px;
    color: #1e3c72;
    margin-bottom: 8px;
}

.page-header p {
    color: #666;
    font-size: 16px;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 25px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.card-header h3 {
    font-size: 20px;
    color: #333;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #4CAF50;
    color: white;
}

.btn-success:hover {
    background: #45a049;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

.btn-warning {
    background: #FF9800;
    color: white;
}

.btn-warning:hover {
    background: #e68900;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: #f8f9fa;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    font-size: 14px;
}

td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

tr:hover {
    background: #f8f9fa;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.table-actions .btn {
    padding: 6px 12px;
    font-size: 13px;
}

/* Dashboard */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.metric-card h3 {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 10px;
}

.metric-card .value {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 5px;
}

.metric-card .change {
    font-size: 12px;
    opacity: 0.8;
}

/* Charts */
.chart-container {
    position: relative;
    height: 400px;
    margin-bottom: 20px;
}

/* Pipeline */
.pipeline-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.pipeline-column {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    min-height: 400px;
}

.pipeline-header {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    padding: 10px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    text-align: center;
}

.deal-card {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    cursor: move;
    transition: all 0.3s;
}

.deal-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.deal-card h4 {
    font-size: 15px;
    color: #333;
    margin-bottom: 8px;
}

.deal-card p {
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

.deal-value {
    font-size: 16px;
    font-weight: 700;
    color: #4CAF50;
    margin-top: 10px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    animation: slideDown 0.3s;
    position: relative;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.modal-header h2 {
    font-size: 24px;
    color: #333;
}

.close {
    font-size: 28px;
    font-weight: 700;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #333;
}

.modal-footer {
    margin-top: 25px;

/* Company dropdown hover effect */
.company-option:hover {
    background-color: #f0f7ff !important;
}
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 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: 3000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
}

/* Alert animations for fixed positioning */
@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* File Upload */
.file-upload {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.file-upload:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.file-upload i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 15px;
}

.file-upload p {
    color: #666;
    margin-top: 10px;
}

/* Pricing Calculator */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.pricing-tier {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
}

.pricing-tier-header {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.pricing-tier-value {
    font-size: 32px;
    font-weight: 700;
}

.pricing-tier-currency {
    font-size: 14px;
    opacity: 0.8;
    margin-top: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .calculator-grid {
        grid-template-columns: 1fr;
    }
    
    .pipeline-board {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    .sidebar, .btn, .modal {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* Searchable Dropdown Component - V13.4.2.12 FIXED */
.searchable-dropdown-container {
    position: relative !important;
    width: 100%;
}

.searchable-dropdown {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    background: white !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    z-index: 100000 !important;
    margin-top: 5px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    display: none;
    transform: none !important;
}

/* Dropdown items */
.searchable-dropdown-item,
.company-option {
    position: relative !important;
    transform: none !important;
}

/* Modal-specific dropdown rules */
.modal .searchable-dropdown,
.modal-overlay .searchable-dropdown,
#companyDropdown,
#productSearchDropdown,
#editProductSearchDropdown {
    position: absolute !important;
    z-index: 100001 !important;
}

/* Ensure containers maintain positioning context */
.modal .searchable-dropdown-container,
.modal-overlay .searchable-dropdown-container,
div[style*="position: relative"] {
    position: relative !important;
}

.searchable-dropdown-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

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

.searchable-dropdown-item:hover,
.searchable-dropdown-item.active {
    background: #f8f9fa;
}

.searchable-dropdown-item.active {
    background: #e3f2fd;
}

/* Multi-Select Tags Component */
.multi-select-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

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

.multi-select-item:hover,
.multi-select-item.active {
    background: #f8f9fa;
}

.multi-select-item.active {
    background: #e3f2fd;
}

.multi-select-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    min-height: 50px;
    align-items: flex-start;
}

.multi-select-tag {
    display: inline-flex;
    align-items: center;
    background: #667eea;
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    gap: 8px;
}

.multi-select-tag-remove {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.2s ease;
}

.multi-select-tag-remove:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Global Search Results */
.global-search-results {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-height: 500px;
    overflow-y: auto;
    z-index: 10000;
}

.global-search-category {
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    font-size: 13px;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.global-search-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.global-search-item:hover {
    background: #f8f9fa;
    border-left: 3px solid #667eea;
}

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

.global-search-item-title {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 5px;
}

.global-search-item-details {
    font-size: 13px;
    color: #666;
}

.global-search-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.global-search-badge {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.global-search-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}

.global-search-no-results i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #ddd;
}

/* Resizable Modal Styles */
.resizable-modal-content {
    position: relative;
    transition: all 0.3s ease;
}

.resizable-modal-content.maximized {
    width: 98% !important;
    height: 95vh !important;
    max-width: none !important;
    margin: 1% auto !important;
}

.resizable-modal-content.minimized {
    height: 60px !important;
    overflow: hidden !important;
}

.btn-modal-control {
    background: transparent;
    border: none;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    padding: 5px 10px;
    transition: all 0.2s;
    border-radius: 4px;
}

.btn-modal-control:hover {
    background: rgba(0,0,0,0.05);
    color: #333;
}

.modal-header .btn-modal-control {
    color: #999;
}

.modal-header .btn-modal-control:hover {
    color: #333;
    background: rgba(0,0,0,0.05);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Toast Animations - v7.3.1 */
@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu {
    animation: fadeIn 0.2s;
}

.dropdown-item {
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: #f5f7fa !important;
    padding-left: 20px !important;
    transform: translateX(2px);
}

.dropdown-item:active {
    background: #e8eef5 !important;
}

/* Mobile Responsive Improvements */
@media (max-width: 768px) {
    .dropdown-menu {
        right: 0;
        left: auto;
    }
}

/* Quote Summary Card Styles - v2.10.1 Optimized */
.summary-card {
    transition: all 0.3s ease;
    cursor: default;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

/* Smooth scaling for icons */
.summary-icon {
    transition: transform 0.3s ease;
}

.summary-card:hover .summary-icon {
    transform: scale(1.1);
}

/* Responsive summary grid - v2.10.1 Enhanced Breakpoints */
@media (min-width: 1401px) {
    /* Large desktop - constrain max width */
    .summary-grid {
        max-width: 1400px;
    }
}

@media (min-width: 1201px) and (max-width: 1400px) {
    /* Medium desktop - tighter spacing */
    .summary-grid {
        gap: 14px !important;
    }
}

@media (min-width: 1025px) and (max-width: 1200px) {
    /* Small desktop - 3-2 layout pattern */
    .summary-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 14px !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    /* Tablet landscape */
    .summary-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 12px !important;
    }
    
    .summary-card {
        padding: 12px !important;
    }
}

@media (min-width: 601px) and (max-width: 768px) {
    /* Tablet portrait */
    .summary-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
}

@media (max-width: 600px) {
    /* Mobile */
    .summary-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    
    .summary-card {
        padding: 14px !important;
    }
}

/* Modal Responsive Styles - V13.4.2.10 */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95vw !important;
        width: 95vw !important;
        max-height: 95vh !important;
        padding: 20px !important;
    }
}

@media (max-width: 480px) {
    .modal-content {
        max-width: 98vw !important;
        width: 98vw !important;
        max-height: 98vh !important;
        padding: 15px !important;
    }
}

/* Notification Container Responsive */
@media (max-width: 768px) {
    #notification-container {
        top: 60px !important;
        right: 10px !important;
        left: 10px !important;
        max-width: calc(100% - 20px) !important;
    }
    
    .alert {
        min-width: unset !important;
        width: 100% !important;
        font-size: 14px !important;
    }
}

@media (max-width: 480px) {
    #notification-container {
        top: 50px !important;
        right: 5px !important;
        left: 5px !important;
        max-width: calc(100% - 10px) !important;
    }
    
    .alert {
        padding: 12px 15px !important;
        font-size: 13px !important;
    }
}
