/* Reset and 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-color: #f5f5f5;
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 450px;
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header .logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 20px;
}

.login-header h1 {
    font-size: 24px;
    color: #333;
    margin-bottom: 8px;
}

.login-header .subtitle {
    color: #666;
    font-size: 14px;
}

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

.login-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.login-pb-branding {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.pb-logo-small {
    height: 30px;
    width: 30px;
    border-radius: 50%;
}

.pb-text-small {
    font-size: 11px;
    color: #374151;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background-color: #2563eb;
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: start;
}

.pb-logo {
    height: 50px;
    width: 50px;
    border-radius: 50%;
}

.pb-tagline {
    font-size: 12px;
    color: #e5e7eb;
    font-weight: 400;
}

.header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    justify-self: center;
}

.header-logo {
    height: 50px;
    width: auto;
    background-color: white;
    padding: 5px 15px;
    border-radius: 4px;
}

.header-center h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: white;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
}

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

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dropdown-toggle svg {
    transition: transform 0.2s;
}

.dropdown.active .dropdown-toggle svg {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    z-index: 1000;
    overflow: hidden;
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    text-align: left;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
}

.dropdown-item:active {
    background-color: #e5e7eb;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 0;
    overflow: hidden;
}

/* Split Container */
.split-container {
    display: flex;
    height: calc(100vh - 90px);
    /* Subtract header height */
    overflow: hidden;
    position: relative;
}

.left-pane,
.right-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.left-pane.collapsed {
    flex: 0;
    min-width: 0;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
}

.left-pane.hidden {
    display: none !important;
}

.right-pane.expanded {
    flex: 1;
}

.right-pane.full-width {
    flex: 1;
    width: 100%;
}

/* Pane Toggle Button */
.pane-toggle {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    background: #2563eb;
    border: 2px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.pane-toggle:hover {
    background: #1d4ed8;
    transform: translate(-50%, -50%) scale(1.1);
}

.pane-toggle svg {
    color: white;
    transition: transform 0.3s ease;
}

.pane-toggle.collapsed {
    left: 20px;
    transform: translate(0, -50%);
}

.pane-toggle.collapsed:hover {
    transform: translate(0, -50%) scale(1.1);
}

.pane-toggle.collapsed svg {
    transform: rotate(180deg);
}

.pane-toggle.hidden {
    display: none !important;
}

.left-pane {
    border-right: 1px solid #e5e5e5;
}

.pane-header {
    padding: 20px;
    background-color: white;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pane-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

/* Document Badges */
.doc-badges {
    display: flex;
    gap: 8px;
}

.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.badge-secondary {
    background-color: #6b7280;
    color: white;
}

.badge-order {
    background-color: #10b981;
    color: white;
}

.badge-invoice {
    background-color: #3b82f6;
    color: white;
}

/* Drop Zone */
.drop-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background-color: #f9fafb;
    border: 2px dashed #d1d5db;
    margin: 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.drop-zone:hover {
    border-color: #2563eb;
    background-color: #eff6ff;
}

.drop-zone.drag-over {
    border-color: #2563eb;
    background-color: #dbeafe;
    border-style: solid;
}

.upload-icon {
    color: #6b7280;
    margin-bottom: 16px;
}

.drop-text {
    font-size: 16px;
    color: #374151;
    margin-bottom: 8px;
}

.drop-text-small {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 16px;
}

/* PDF Viewer */
.pdf-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pdf-header {
    padding: 15px 20px;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pdf-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pdf-filename {
    font-weight: 500;
    color: #111827;
}

.pdf-size {
    font-size: 12px;
    color: #6b7280;
}

.replace-pdf-drop-zone {
    padding: 8px 16px;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    background-color: #f9fafb;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    font-size: 13px;
}

.replace-pdf-drop-zone:hover {
    border-color: #667eea;
    background-color: #eff6ff;
    color: #667eea;
}

.replace-pdf-drop-zone.drag-over {
    border-color: #667eea;
    background-color: #dbeafe;
    color: #667eea;
    transform: scale(1.02);
}

.replace-pdf-drop-zone svg {
    width: 20px;
    height: 20px;
}

.pdf-content {
    flex: 1;
    background-color: #525252;
    position: relative;
}

.pdf-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Drop Zone Hero Animation */
@keyframes dropZoneExit {
    0% {
        opacity: 1;
        transform: scale(1) translate(0, 0);
    }

    60% {
        opacity: 0;
        transform: scale(0.5) translate(85%, -105%);
    }

}

@keyframes pdfViewerEnter {
    0% {
        opacity: 0;
    }

    20% {
        opacity: 0;
    }

    70% {
        opacity: 1;
    }
}

.drop-zone-exit {
    animation: dropZoneExit 500ms ease-in-out forwards;
}

.pdf-viewer-enter {
    animation: pdfViewerEnter 500ms ease-in-out forwards;
}

/* Empty State */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: #9ca3af;
}

.empty-state svg {
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 16px;
}

/* Parsed Form */
.parsed-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
}

.form-fields {
    flex: 1;
    overflow-y: auto;
}

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

/* Address field widths for City/State/ZIP row */
.form-group-city {
    flex: 25;
    min-width: 150px;
}

.form-group-state {
    flex: 4;
    min-width: 60px;
    max-width: 100px;
}

.form-group-zip {
    flex: 10;
    min-width: 100px;
    max-width: 180px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: #333;
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #111827;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* Line Items Table */
.line-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}

.line-items-table th {
    background-color: #f3f4f6;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
}

.line-items-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
}

.line-items-table td input {
    padding: 6px 8px;
    font-size: 13px;
}

/* Remove spin buttons from number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.add-line-item-btn {
    margin-top: 12px;
    display: inline-block;
}

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

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

.btn-primary {
    background-color: #2563eb;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1d4ed8;
}

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

.btn-secondary:hover:not(:disabled) {
    background-color: #4b5563;
}

.btn-accent {
    background-color: #10b981;
    color: white;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    display: inline-flex;
    align-items: center;
}

.btn-accent:hover:not(:disabled) {
    background-color: #059669;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.16);
    transform: translateY(-1px);
}

.btn-accent:active:not(:disabled) {
    background-color: #047857;
    transform: translateY(0);
}

.btn-outline {
    background-color: transparent;
    color: white;
    border: 1px solid white;
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

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

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
    display: block;
}

.form-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.form-actions-center {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-error {
    background-color: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.alert-success {
    background-color: #d1fae5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}

.alert-warning {
    background-color: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
}

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

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.3);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.modal-header.success {
    background-color: #d1fae5;
    color: #065f46;
}

.modal-header.error {
    background-color: #fee2e2;
    color: #991b1b;
}

.modal-header.warning {
    background-color: #fef3c7;
    color: #92400e;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-close:hover {
    color: #111827;
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    margin-bottom: 10px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e5e5e5;
    text-align: right;
}

/* Utility Classes */
.text-muted {
    color: #6b7280;
}

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

/* Responsive */
@media (max-width: 1024px) {
    .split-container {
        flex-direction: column;
        height: auto;
    }

    .left-pane {
        border-right: none;
        border-bottom: 1px solid #e5e5e5;
        height: 50vh;
    }

    .right-pane {
        height: auto;
    }
}

@media (max-width: 768px) {
    .header-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .header-left {
        justify-self: center;
    }

    .header-center {
        justify-self: center;
    }

    .header-right {
        justify-self: center;
    }

    .header-logo {
        height: 40px;
    }

    .pb-logo {
        height: 40px;
        width: 40px;
    }

    .header-center h1 {
        font-size: 18px;
    }

    .login-header .logo {
        max-width: 150px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* SAP GL Accounts Styles */
.gl-accounts-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}

.gl-accounts-table th {
    background-color: #f3f4f6;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
}

.gl-accounts-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
}

.gl-accounts-table td input {
    padding: 6px 8px;
    font-size: 13px;
}

.gl-account-row {
    transition: background-color 0.2s;
}

.gl-account-row:hover {
    background-color: #f9fafb;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
}

.autocomplete-item:hover,
.autocomplete-item.autocomplete-active {
    background-color: #eff6ff;
}

.autocomplete-item strong {
    color: #2563eb;
}

/* GL Total Summary */
.gl-total-summary {
    margin-top: 15px;
}

.amount-mismatch {
    background-color: #fee2e2 !important;
    color: #991b1b;
}

/* Delete GL Button */
.btn-delete-gl {
    background-color: #dc2626;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.btn-delete-gl:hover {
    background-color: #b91c1c;
}

/* GL Account Input Width */
.gl-account-input {
    min-width: 120px;
}

.gl-description-input {
    min-width: 200px;
}

.gl-amount-input {
    min-width: 100px;
    text-align: right;
}

/* Custom Tooltip for Disabled Buttons */
.btn[disabled] {
    position: relative;
    cursor: not-allowed;
}

.btn[disabled][data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 8px 12px;
    background-color: #1f2937;
    color: white;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.4;
    white-space: nowrap;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    pointer-events: none;
    animation: fadeIn 0.1s ease-in;
}

.btn[disabled][data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 2px;
    border: 6px solid transparent;
    border-top-color: #1f2937;
    z-index: 1000;
    pointer-events: none;
    animation: fadeIn 0.1s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #1f2937;
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: #6b7280;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
    margin-top: 0.5rem;
}

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