/**
 * PackQuote CSS
 * Clean, professional design with Inter font
 */

/* ============================================================================
   RESET & BASE STYLES
   ============================================================================ */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1F2937;
    background-color: #FFFFFF;
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */

h1 {
    font-size: 24px;
    font-weight: 600;
    color: #1B4F72;
    margin-bottom: 16px;
}

h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1B4F72;
    margin-bottom: 12px;
}

h3 {
    font-size: 16px;
    font-weight: 500;
    color: #1B4F72;
    margin-bottom: 8px;
}

label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6B7280;
    margin-bottom: 6px;
}

/* ============================================================================
   LAYOUT
   ============================================================================ */

.navbar {
    background-color: #1B4F72;
    color: white;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
}

.navbar-brand a {
    color: white;
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
}

.navbar-menu {
    list-style: none;
    display: flex;
    gap: 24px;
    align-items: center;
}

.navbar-menu li {
    position: relative;
}

.navbar-menu a {
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    display: block;
    transition: background-color 0.2s;
}

.navbar-menu a:hover {
    background-color: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 200px;
    z-index: 1000;
    list-style: none;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu a {
    color: #1F2937;
    padding: 10px 16px;
}

.dropdown-menu a:hover {
    background-color: #F3F4F6;
}

.dropdown-menu .divider {
    height: 1px;
    background: #E5E7EB;
    margin: 8px 0;
}

.main-content {
    min-height: calc(100vh - 120px);
    padding: 24px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.quote-form-container {
    max-width: 960px;
}

.footer {
    background-color: #F9FAFB;
    padding: 16px 24px;
    text-align: center;
    color: #6B7280;
    font-size: 12px;
    border-top: 1px solid #E5E7EB;
}

/* ============================================================================
   COMPONENTS
   ============================================================================ */

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #1B4F72;
    color: white;
}

.btn-primary:hover {
    background-color: #164060;
}

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

.btn-secondary:hover {
    background-color: #4B5563;
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn-link {
    color: #2E86C1;
    background: none;
    padding: 4px 8px;
    text-decoration: underline;
}

/* Forms */
.form-section {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.section-header {
    padding: 16px 24px;
    border-bottom: 1px solid #E5E7EB;
    background-color: #F9FAFB;
}

.section-content {
    padding: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    font-size: 14px;
    background-color: #F3F4F6;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1B4F72;
    background-color: white;
}

.form-group.checkbox {
    display: flex;
    align-items: center;
}

.form-group.checkbox label {
    display: flex;
    align-items: center;
    font-size: 14px;
    text-transform: none;
    letter-spacing: normal;
    color: #1F2937;
    margin: 0;
}

.form-group.checkbox input {
    width: auto;
    margin-right: 8px;
}

.form-group small {
    display: block;
    font-size: 11px;
    color: #6B7280;
    margin-top: 4px;
}

.form-actions {
    display: flex;
    gap: 12px;
    padding: 24px;
    background-color: #F9FAFB;
    border-top: 1px solid #E5E7EB;
    border-radius: 0 0 6px 6px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.data-table thead {
    background-color: #F9FAFB;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6B7280;
    border-bottom: 1px solid #E5E7EB;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #F3F4F6;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background-color: #F9FAFB;
}

/* Cards */
.stat-card {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-card h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6B7280;
    margin-bottom: 8px;
}

.stat-number {
    font-size: 32px;
    font-weight: 600;
    color: #1B4F72;
}

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

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-draft {
    background-color: #FEF3C7;
    color: #92400E;
}

.badge-calculated {
    background-color: #DBEAFE;
    color: #1E40AF;
}

.badge-quoted {
    background-color: #D1FAE5;
    color: #065F46;
}

.badge-confirmed {
    background-color: #D1FAE5;
    color: #065F46;
}

/* Alerts */
.flash-messages {
    max-width: 1200px;
    margin: 0 auto 24px;
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.alert-success {
    background-color: #D1FAE5;
    color: #065F46;
    border: 1px solid #10B981;
}

.alert-error {
    background-color: #FEE2E2;
    color: #991B1B;
    border: 1px solid #EF4444;
}

.alert-warning {
    background-color: #FEF3C7;
    color: #92400E;
    border: 1px solid #F59E0B;
}

.alert-info {
    background-color: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #3B82F6;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section {
    margin-bottom: 32px;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #6B7280;
}

/* ============================================================================
   LOGIN PAGE
   ============================================================================ */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1B4F72 0%, #2E86C1 100%);
}

.login-card {
    background: white;
    border-radius: 8px;
    padding: 48px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 8px;
}

.login-subtitle {
    text-align: center;
    color: #6B7280;
    margin-bottom: 32px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: #6B7280;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .navbar-menu {
        flex-direction: column;
        gap: 0;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ============================================================================
   CUSTOMER AUTOCOMPLETE
   ============================================================================ */

.customer-autocomplete-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.customer-autocomplete-container input[type="text"] {
    flex: 1;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 50px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 4px;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #F3F4F6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.suggestion-item:hover {
    background-color: #EBF5FB;
}

.suggestion-item strong {
    color: #1B4F72;
    font-weight: 500;
}

.customer-group {
    font-size: 12px;
    color: #6B7280;
    padding: 2px 8px;
    background-color: #F3F4F6;
    border-radius: 4px;
}

.no-results {
    padding: 12px 16px;
    color: #6B7280;
    text-align: center;
}

.btn-refresh {
    background: none;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 18px;
    color: #1B4F72;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-refresh:hover {
    background-color: #EBF5FB;
    border-color: #1B4F72;
}

.btn-refresh:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.erpnext-status {
    display: block;
    font-size: 11px;
    margin-top: 4px;
}

.erpnext-status.online {
    color: #10B981;
}

.erpnext-status.offline {
    color: #F59E0B;
}

/* ============================================================================
   NOTIFICATIONS
   ============================================================================ */

.notification {
    position: fixed;
    top: 80px;
    right: 24px;
    padding: 12px 24px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-success {
    background-color: #D1FAE5;
    border-left: 4px solid #10B981;
    color: #065F46;
}

.notification-error {
    background-color: #FEE2E2;
    border-left: 4px solid #EF4444;
    color: #991B1B;
}

.notification-info {
    background-color: #DBEAFE;
    border-left: 4px solid #3B82F6;
    color: #1E40AF;
}

/* ============================================================================
   PUSH TO ERPNEXT BUTTON
   ============================================================================ */

.btn-erpnext {
    background-color: #F59E0B;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-erpnext:hover {
    background-color: #D97706;
}

.btn-erpnext:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-erpnext .spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.erpnext-link {
    display: inline-block;
    margin-top: 8px;
    color: #2E86C1;
    text-decoration: none;
    font-size: 13px;
}

.erpnext-link:hover {
    text-decoration: underline;
}

/* Quote status badge */
.quote-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.quote-status.draft {
    background-color: #F3F4F6;
    color: #6B7280;
}

.quote-status.calculated {
    background-color: #DBEAFE;
    color: #1E40AF;
}

.quote-status.quoted {
    background-color: #FEF3C7;
    color: #92400E;
}

.quote-status.pushed {
    background-color: #D1FAE5;
    color: #065F46;
}

.quote-status.confirmed {
    background-color: #D1FAE5;
    color: #065F46;
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    /* Hide non-essential elements */
    .navbar,
    .btn,
    button,
    .no-print,
    .page-header .btn-group,
    .form-section button,
    .notification,
    .autocomplete-suggestions {
        display: none !important;
    }
    
    /* Reset page margins */
    body {
        padding: 0;
        margin: 0;
        background: white;
    }
    
    /* Remove box shadows and borders */
    .card,
    .section {
        box-shadow: none;
        page-break-inside: avoid;
    }
    
    /* Optimize tables for print */
    table {
        page-break-inside: avoid;
    }
    
    tr {
        page-break-inside: avoid;
    }
    
    /* Force black text for better printing */
    body,
    h1, h2, h3, h4, h5, h6,
    p, td, th, li {
        color: #000 !important;
    }
    
    /* Remove background colors (except essential ones) */
    .form-section,
    .card {
        background: white !important;
    }
    
    /* Keep essential background colors for readability */
    .cost-card,
    .summary-box,
    .quote-info {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* Page breaks */
    .page-break-before {
        page-break-before: always;
    }
    
    .page-break-after {
        page-break-after: always;
    }
    
    /* Avoid breaking these elements */
    .cost-grid,
    .quote-info,
    .section-title {
        page-break-inside: avoid;
    }
}

/* ============================================================================
   LOADING SPINNER
   ============================================================================ */

.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-container {
    background: white;
    padding: 30px 40px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #E5E7EB;
    border-top-color: #1B4F72;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

.spinner-text {
    color: #1F2937;
    font-weight: 500;
    font-size: 14px;
}

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */

.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    padding: 16px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideInRight 0.3s ease;
    cursor: pointer;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    background: #D1FAE5;
    border-left: 4px solid #10B981;
    color: #065F46;
}

.toast-error {
    background: #FEE2E2;
    border-left: 4px solid #EF4444;
    color: #991B1B;
}

.toast-warning {
    background: #FEF3C7;
    border-left: 4px solid #F59E0B;
    color: #92400E;
}

.toast-info {
    background: #DBEAFE;
    border-left: 4px solid #3B82F6;
    color: #1E40AF;
}

.toast-icon {
    font-size: 20px;
    line-height: 1;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    opacity: 0.9;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.6;
    font-size: 18px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    opacity: 1;
}

/* ============================================================================
   CONFIRMATION DIALOG
   ============================================================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    animation: fadeIn 0.2s ease;
}

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

.modal {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.modal-icon.danger {
    background: #FEE2E2;
    color: #EF4444;
}

.modal-icon.warning {
    background: #FEF3C7;
    color: #F59E0B;
}

.modal-icon.info {
    background: #DBEAFE;
    color: #3B82F6;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1F2937;
    flex: 1;
}

.modal-body {
    padding: 24px;
    color: #6B7280;
    line-height: 1.6;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-footer .btn {
    margin: 0;
}

/* ============================================================================
   KEYBOARD SHORTCUTS HINT
   ============================================================================ */

.keyboard-hint {
    font-size: 11px;
    color: #9CA3AF;
    margin-left: 8px;
    padding: 2px 6px;
    background: #F3F4F6;
    border-radius: 3px;
    font-family: monospace;
}

/* ============================================================================
   QUOTE LIST FILTERS
   ============================================================================ */

.filter-bar {
    background: #F9FAFB;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin: 0;
}

.filter-group select,
.filter-group input {
    min-width: 150px;
    padding: 6px 12px;
    font-size: 13px;
}

.filter-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

/* ============================================================================
   PAGINATION
   ============================================================================ */

.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
}

.pagination-btn {
    padding: 6px 12px;
    border: 1px solid #E5E7EB;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: #EBF5FB;
    border-color: #1B4F72;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: #1B4F72;
    color: white;
    border-color: #1B4F72;
}

.pagination-info {
    font-size: 13px;
    color: #6B7280;
    margin: 0 8px;
}
