/* ============================================================================
   Base Popup Styles
   Common styles for all popups (overlay, container, header, buttons, content)
   ============================================================================ */

/* Report popup overlay - covers entire viewport */
.report-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9999;
}

/* Report popup container - fixed positioning for free movement */
.report-popup {
    position: fixed;
    width: 750px;
    height: 700px;
    min-width: 200px;
    min-height: 150px;
    max-width: 90vw;
    max-height: 90vh;
    background: #1a1a2e;
    border: 1px solid #4a4a6a;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    animation: popupFadeIn 0.2s ease;
    overflow: hidden;
    /* Padding for resize edges - allows mouse to detect edges */
    padding: 4px;
    box-sizing: border-box;
}

.report-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    background: #2a2a4e;
    border-bottom: 1px solid #4a4a6a;
    border-radius: 4px 4px 0 0;
}

.report-popup-title {
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

.report-popup-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.report-popup-pdf {
    background: #4a7c59;
    border: none;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.report-popup-pdf:hover {
    background: #5a9c69;
}

.report-popup-excel {
    background: #217346;
    border: none;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.report-popup-excel:hover {
    background: #2a9356;
}

.report-popup-close-btn {
    background: #8b4a4a;
    border: none;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.report-popup-close-btn:hover {
    background: #a85a5a;
}

.report-popup-content {
    padding: 12px;
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
    color: #ddd;
    font-size: 14px;
    line-height: 1.5;
}

/* Standard popup header line - first line in all report popups */
.popup-header-line {
    font-size: 11px;
    font-style: italic;
    color: #8a8aa0;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #3a3a5a;
    text-align: right;
}

/* Main content text styling for report popups */
.popup-main-content {
    font-size: 14px;
    color: #e0e0e0;
    line-height: 1.6;
}

.popup-main-content p {
    margin: 0 0 10px 0;
}

/* Click popup styling (small tooltips) */
.click-popup {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: popupFadeIn 0.2s ease;
}

.click-popup.fade-out {
    animation: popupFadeOut 0.3s ease forwards;
}

/* Popup title styling */
.popup-title {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    font-size: 18px;
    font-weight: bold;
    color: #4CAF50;
    border-bottom: 2px solid #4CAF50;
    text-align: center;
}

.popup-content {
    margin-bottom: 20px;
}

.popup-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-popup {
    padding: 8px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

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

/* User Info Popup */
.user-info-popup {
    position: absolute;
    background-color: white;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 300px;
    max-width: 400px;
}

/* Change Password Popup */
.change-password-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    border: 2px solid #2196F3;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    min-width: 350px;
    max-width: 450px;
}

.change-password-popup .form-field {
    margin-bottom: 15px;
}

.change-password-popup .form-field label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

.change-password-popup .form-field input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.change-password-popup .form-field input:focus {
    outline: none;
    border-color: #2196F3;
}

/* Info line styling */
.info-line {
    margin-bottom: 10px;
    font-size: 14px;
    color: #333;
}

.info-line strong {
    display: inline-block;
    width: 80px;
    color: #666;
}

/* Popup button variants */
.btn-change-password {
    background-color: #2196F3;
    color: white;
}

.btn-change-password:hover {
    background-color: #0b7dda;
    transform: translateY(-2px);
}

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

.btn-logout:hover {
    background-color: #da190b;
    transform: translateY(-2px);
}

.btn-cancel {
    background-color: #757575;
    color: white;
}

.btn-cancel:hover {
    background-color: #616161;
    transform: translateY(-2px);
}

/* Customer Report Dialog */
.customer-dialog {
    min-width: 420px;
    max-width: 500px;
    height: auto;
    min-height: auto;
}

.customer-dialog-content {
    padding: 25px 25px 20px 25px;
}

.customer-dialog-intro {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: white;
}

.customer-radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-left: 20px;
}

.customer-radio-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
}

.customer-radio-option input[type="radio"] {
    margin-top: 3px;
    cursor: pointer;
}

.customer-radio-option span {
    flex: 1;
}

.customer-select {
    margin-left: 5px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    background-color: #f5f5dc;
    border-radius: 4px;
    font-size: 13px;
}

.customer-dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    padding-bottom: 5px;
    border-top: 1px solid #eee;
}

.customer-dialog-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.customer-dialog-btn.execute-btn {
    background-color: #4CAF50;
    color: white;
}

.customer-dialog-btn.execute-btn:hover {
    background-color: #45a049;
}

.customer-dialog-btn.cancel-btn {
    background-color: #f0f0f0;
    color: #333;
}

.customer-dialog-btn.cancel-btn:hover {
    background-color: #e0e0e0;
}

/* Customer Selector Section (at bottom of all customers report) */
.customer-selector-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #4a4a6a;
    font-size: 14px;
    color: #e0e0e0;
}

.customer-detail-btn {
    padding: 6px 14px;
    background-color: #4a7c59;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.customer-detail-btn:hover {
    background-color: #5a9c69;
}

/* Customer Pie Charts Section */
.customer-pie-charts-section {
    margin: 15px 0;
    padding: 10px;
    background-color: #1e1e3a;
    border-radius: 6px;
}

.customer-pie-charts-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.customer-pie-charts-row:last-child {
    margin-bottom: 0;
}

.customer-pie-chart-container {
    flex: 1;
    min-width: 0;
    background-color: #2a2a4e;
    border-radius: 4px;
    padding: 8px;
}

.customer-pie-chart-container h4 {
    margin: 0 0 6px 0;
    font-size: 10px;
    color: #a0a0c0;
    text-align: center;
    font-weight: normal;
}

.customer-pie-chart-container canvas {
    width: 100% !important;
    height: 90px !important;
}

/* Customer Table Header */
.customer-table-header {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #a0a0c0;
    font-weight: normal;
}

/* Make customer table rows clickable */
.customer-report-table tbody tr:not(.totals-row) {
    cursor: pointer;
    transition: background-color 0.15s;
}

.customer-report-table tbody tr:not(.totals-row):hover {
    background-color: #3a3a5e !important;
}

/* ============================================================================
   Help Popup Content Styles
   ============================================================================ */

.help-popup-content {
    color: #e0e0e0;
    font-size: 14px;
    line-height: 1.6;
}

.help-popup-content h3 {
    color: #4CAF50;
    font-size: 18px;
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #4CAF50;
}

.help-popup-content h4 {
    color: #8ab4f8;
    font-size: 15px;
    margin: 20px 0 10px 0;
}

.help-popup-content p {
    margin: 0 0 12px 0;
}

.help-popup-content ul,
.help-popup-content ol {
    margin: 0 0 15px 0;
    padding-left: 25px;
}

.help-popup-content li {
    margin-bottom: 8px;
}

.help-popup-content ul ul {
    margin-top: 8px;
    margin-bottom: 8px;
}

.help-popup-content strong {
    color: #fff;
}

.help-popup-content em {
    color: #a0a0c0;
    font-style: italic;
}

.help-popup-content a.help-link,
.help-popup-content a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: bold;
}

.help-popup-content a.help-link:hover,
.help-popup-content a:hover {
    color: #6fcf7f;
    text-decoration: underline;
}

/* ============================================================================
   Animation Explanation Panel Styles
   ============================================================================ */

.animation-explanation-panel {
    position: absolute;
    /* Position (942, 172) in 1280x640 coordinate system */
    /* x: 942/1280 = 73.59%, y: 172/640 = 26.88% */
    left: 73.59%;
    top: 26.88%;
    width: 330px;
    min-height: 380px;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid #4a4a6a;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.3s ease;
}

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

.animation-explanation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #2a2a4e;
    border-bottom: 1px solid #4a4a6a;
    border-radius: 8px 8px 0 0;
}

.animation-explanation-title {
    color: #4CAF50;
    font-size: 16px;
    font-weight: bold;
}

.animation-explanation-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.animation-control-btn {
    background: #3a3a5e;
    border: 1px solid #5a5a7a;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.animation-control-btn:hover {
    background: #4a4a6e;
}

.animation-control-btn.active {
    background: #4CAF50;
    border-color: #6fcf7f;
}

.animation-explanation-content {
    padding: 8px 12px;
    overflow-y: auto;
    flex: 1;
    color: #e0e0e0;
    font-size: 14px;
    line-height: 1.3;
}

.animation-step-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.animation-step-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 8px;
    margin-bottom: 3px;
    background: #2a2a4e;
    border-radius: 4px;
    opacity: 0.4;
    transition: all 0.3s ease;
}

.animation-step-item.completed {
    opacity: 1;
}

.animation-step-item.active {
    opacity: 1;
    background: #3a3a5e;
}

.animation-step-bullet {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3a3a5e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: bold;
    color: #fff;
}

/* Step bullet colors per process area:
   Steps 1-3: Orange (Market/Sales) #E78934
   Step 4: Blue (Planning) #2D4585
   Steps 5-6: Green (Purchasing/Vendors) #7CB450
   Steps 7-8: Blue (Production) #2D4585
   Step 9: Orange (Distribution) #E78934
   Steps 10-11: Yellow (Finance) #F0D351
*/
.animation-step-item[data-step="1"] .animation-step-bullet,
.animation-step-item[data-step="2"] .animation-step-bullet,
.animation-step-item[data-step="3"] .animation-step-bullet {
    background: #E78934;
}

.animation-step-item[data-step="4"] .animation-step-bullet {
    background: #2D4585;
}

.animation-step-item[data-step="5"] .animation-step-bullet,
.animation-step-item[data-step="6"] .animation-step-bullet {
    background: #7CB450;
}

.animation-step-item[data-step="7"] .animation-step-bullet,
.animation-step-item[data-step="8"] .animation-step-bullet {
    background: #2D4585;
}

.animation-step-item[data-step="9"] .animation-step-bullet {
    background: #E78934;
}

.animation-step-item[data-step="10"] .animation-step-bullet,
.animation-step-item[data-step="11"] .animation-step-bullet {
    background: #F0D351;
    color: #000;
}

.animation-step-text {
    flex: 1;
    font-size: 12px;
}

.animation-step-item.completed .animation-step-text {
    color: #a0e0a0;
}

.animation-step-item.active .animation-step-text {
    color: #fff;
    font-weight: bold;
}

.animation-explanation-footer {
    padding: 10px 12px;
    background: #2a2a4e;
    border-top: 1px solid #4a4a6a;
    border-radius: 0 0 8px 8px;
    font-size: 12px;
    color: #8a8aa0;
    text-align: center;
}

.animation-explanation-footer kbd {
    background: #3a3a5e;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #5a5a7a;
    font-family: monospace;
}

/* Instruction message at top of panel */
.animation-instruction-message {
    padding: 8px 12px;
    background: linear-gradient(135deg, #2a4a3e, #1a3a2e);
    border-bottom: 1px solid #4CAF50;
    text-align: center;
    font-size: 13px;
    color: #a0e0a0;
    display: none;
}

.animation-instruction-message.visible {
    display: block;
}

.animation-instruction-message kbd {
    background: #3a5a4e;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #5a7a6a;
    font-family: monospace;
    color: #fff;
}

/* Run Again button styling */
.animation-control-btn.run-again {
    background: #4CAF50;
    border-color: #6fcf7f;
}

.animation-control-btn.run-again:hover {
    background: #5fcf6f;
}

/* Step description element - position and colors are set dynamically per step via JavaScript */
/* Positions use percentages relative to main-content (1280x640) for proper scaling */
.animation-step-description {
    position: absolute;
    left: 46.875%;  /* 600/1280 - default for step 1 */
    top: 9.375%;    /* 60/640 - default for step 1 */
    padding: 8px 16px;
    background: #E78934;
    border: 3px solid #fff;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.5);
    color: #000;
    font-size: 20px;
    font-weight: bold;
    z-index: 8500;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.animation-step-description.visible {
    opacity: 1;
    transform: translateY(0);
}
