/* ==========================================================================
   Premium Redesigned Invoice Workflow Modal - Matches Mesaj Merkezi Brand
   ========================================================================== */

/* Modal Container & Overrides */
#invoiceWorkflowModal {
    padding: 0 !important;
}

#invoiceWorkflowModal .uk-modal-dialog {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: #f8fafc;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden !important;
}

.invoice-workflow-modal {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

/* UIkit Modal transition override */
.uk-modal.uk-open .invoice-workflow-modal {
    transform: none !important;
}

/* Premium Title Bar */
#invoiceWorkflowModal .uk-modal-header {
    padding: 12px 24px !important;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 15px;
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.15);
    z-index: 10;
    position: relative;
}

#invoiceWorkflowModal .uk-modal-header .uk-modal-title {
    color: white !important;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 !important;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

#invoiceWorkflowModal .uk-modal-header .uk-modal-close-default {
    color: rgba(255, 255, 255, 0.8) !important;
    position: absolute !important;
    top: 50% !important;
    right: 20px !important;
    transform: translateY(-50%) !important;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    padding: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#invoiceWorkflowModal .uk-modal-header .uk-modal-close-default:hover {
    color: white !important;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.05) !important;
}

/* Date Restriction Warning - Message Center Style Alert */
#invoiceWorkflowModal .date-restriction-warning {
    display: flex !important;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    color: #fff !important;
    padding: 6px 16px !important;
    border-radius: 20px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    margin-left: auto;
    margin-right: 35px;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

#invoiceWorkflowModal .date-restriction-warning.blocked {
    background: #fff5f5 !important;
    border-color: #feb2b2 !important;
    color: #c53030 !important;
    box-shadow: 0 2px 10px rgba(229, 62, 62, 0.1);
}

/* Body Content Split Layout */
#invoiceWorkflowModal .uk-modal-body {
    height: calc(100vh - 57px);
    overflow: hidden;
    padding: 0;
}

.invoice-modal-content {
    display: flex;
    height: calc(100vh - 57px);
    gap: 16px;
    padding: 16px;
    background: #f1f5f9;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

/* Left Sidebar: Workflow Panel - Matches .mm-menu */
.workflow-panel {
    width: 280px;
    min-width: 280px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.workflow-header {
    background: transparent !important;
    border-bottom: 2px solid #e2e8f0 !important;
    margin: 0 0 20px 0 !important;
    padding: 0 0 12px 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.workflow-header h3 {
    margin: 0;
    color: #2d3748 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Start Button - Matches .mm-send-btn */
#startWorkflowBtn {
    background: #4299e1 !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 6px 12px !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 6px rgba(66, 153, 225, 0.2) !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-transform: none !important;
    height: auto !important;
    line-height: 1.4 !important;
}

#startWorkflowBtn:hover:not(:disabled) {
    background: #3182ce !important;
    box-shadow: 0 4px 10px rgba(66, 153, 225, 0.4) !important;
    transform: translateY(-1px) !important;
}

#startWorkflowBtn:disabled {
    background: #cbd5e0 !important;
    color: #a0aec0 !important;
    box-shadow: none !important;
    cursor: not-allowed;
    transform: none !important;
}

/* Progress Bar - Brand Gradients */
.workflow-progress {
    height: 6px;
    background: #e2e8f0;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}

.workflow-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2) !important;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 10px;
}

/* Steps List - Matches .mm-menu-list & .mm-menu-item */
.workflow-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.workflow-step {
    background: white !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 10px !important;
    padding: 12px 14px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex !important;
    align-items: flex-start !important;
    gap: 12px !important;
    position: relative;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.01) !important;
    border-left: 2px solid #e2e8f0 !important; /* Base border */
}

.workflow-step:hover {
    border-color: #cbd5e0 !important;
    background: #f8fafc !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
}

/* Step Number Badge */
.step-number {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    border-radius: 50% !important;
    background: #edf2f7 !important;
    color: #718096 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    flex-shrink: 0;
    transition: all 0.2s ease !important;
}

.step-content {
    flex: 1;
    min-width: 0;
}

.step-content h4 {
    margin: 0;
    color: #2d3748;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    transition: color 0.2s ease;
}

.step-content p {
    display: none; /* Hide descriptions to stay compact, matching UI mockup */
}

.step-status {
    font-size: 10px !important;
    font-weight: 700 !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
    background: #edf2f7;
    color: #718096;
    display: inline-block;
    margin-top: 6px;
    letter-spacing: 0.3px;
    transition: all 0.2s ease !important;
}

/* Active State - Blue Brand Glow */
.workflow-step.active {
    background: #4299e1 !important;
    border-color: #3182ce !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.35) !important;
}

.workflow-step.active .step-content h4 {
    color: white !important;
}

.workflow-step.active .step-number {
    background: white !important;
    color: #4299e1 !important;
    animation: pulse 1.6s infinite;
}

.workflow-step.active .step-status {
    background: rgba(255, 255, 255, 0.25) !important;
    color: white !important;
}

/* Completed State - Emerald Success theme */
.workflow-step.completed {
    border-color: #48bb78 !important;
    background: #f0fff4 !important;
    color: #276749 !important;
}

.workflow-step.completed .step-content h4 {
    color: #276749 !important;
}

.workflow-step.completed .step-number {
    background: #48bb78 !important;
    color: white !important;
}

.workflow-step.completed .step-status {
    background: #c6f6d5 !important;
    color: #22543d !important;
}

/* Error State - Rose theme */
.workflow-step.error {
    border-color: #f56565 !important;
    background: #fff5f5 !important;
    color: #9b2c2c !important;
}

.workflow-step.error .step-content h4 {
    color: #9b2c2c !important;
}

.workflow-step.error .step-number {
    background: #f56565 !important;
    color: white !important;
}

.workflow-step.error .step-status {
    background: #fed7d7 !important;
    color: #742a2a !important;
}

/* Disabled workflow overlay behavior */
.workflow-disabled .workflow-panel {
    opacity: 0.65;
    pointer-events: none;
}

/* Right Working Workspace: Split Panels */
.main-content-panel {
    width: calc(100% - 280px);
    display: flex;
    gap: 16px;
    height: 100%;
    min-height: 0; /* Respect parent flex constraints and allow scroll */
}

/* Middle Column: Process Details Panel - Matches .mm-settings-panel layout */
.process-details-panel {
    width: 38%;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    min-height: 0; /* Respect parent flex constraints and allow scroll */
}

.process-details-panel .content-header {
    background: transparent !important;
    border-bottom: 2px solid #e2e8f0 !important;
    padding: 18px 20px !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.process-details-panel .content-header h3 {
    margin: 0;
    color: #2d3748 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.process-indicators {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.indicator {
    padding: 3px 10px;
    background: white !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 20px !important;
    font-size: 0.72rem;
    font-weight: 600;
    color: #4a5568;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.process-details-panel .content-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Process Log Area - Styled like high-quality Messaging Terminal logs */
.process-log {
    background: white !important;
    border-radius: 10px !important;
    padding: 16px !important;
    max-height: 100% !important;
    overflow-y: auto !important;
    border: 2px solid #e2e8f0 !important;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.log-entry {
    margin-bottom: 0 !important;
    padding: 14px !important;
    background: #f8fafc !important;
    border-radius: 10px !important;
    border-left: 4px solid #a0aec0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.01) !important;
    transition: all 0.2s ease !important;
}

.log-entry:hover {
    transform: translateX(2px);
    background: #f1f5f9 !important;
}

.log-entry.welcome {
    border-left-color: #3182ce !important;
    background: #ebf8ff !important;
}

.log-entry.info {
    border-left-color: #4299e1 !important;
}

.log-entry.success {
    border-left-color: #48bb78 !important;
    background: #f0fff4 !important;
}

.log-entry.warning {
    border-left-color: #ecc94b !important;
    background: #fffaf0 !important;
}

.log-entry.error {
    border-left-color: #f56565 !important;
    background: #fff5f5 !important;
}

.log-time {
    font-size: 0.72rem !important;
    color: #a0aec0 !important;
    margin-bottom: 6px !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px;
}

.log-message {
    font-size: 0.85rem !important;
    color: #4a5568 !important;
    line-height: 1.5 !important;
    font-weight: 500;
}

/* Right Column: Results Panel - Matches .mm-content-panel layout */
.results-panel {
    width: 62%;
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    min-height: 0; /* Respect parent flex constraints and allow scroll */
}

.results-header {
    padding: 18px 20px !important;
    border-bottom: 2px solid #e2e8f0 !important;
    background: transparent !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.results-header h3 {
    margin: 0;
    color: #2d3748 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
}

.results-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 20px 60px 20px !important;
}

/* Result Cards - Styled beautifully like Message Center cards */
.result-card {
    background: white !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 10px !important;
    padding: 18px !important;
    margin-bottom: 16px !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.01) !important;
    transition: all 0.2s ease !important;
}

.result-card:hover {
    border-color: #cbd5e0 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
}

.result-card h4 {
    margin: 0 0 12px 0 !important;
    color: #2d3748 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-count {
    background: #4299e1 !important;
    color: white !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
}

/* Students Lists inside Result Cards */
.student-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.student-list li {
    padding: 10px 14px !important;
    border-bottom: 1.5px solid #f1f5f9 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 13px !important;
    color: #4a5568 !important;
}

.student-list li:last-child {
    border-bottom: none !important;
}

.student-name {
    font-weight: 600 !important;
    color: #2d3748 !important;
}

.student-status {
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 2px 8px !important;
    border-radius: 6px !important;
    letter-spacing: 0.3px;
    background: #edf2f7;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.student-status.active {
    background: #f0fff4 !important;
    color: #276749 !important;
    border: 1px solid #c6f6d5 !important;
}

.student-status.finished {
    background: #fffaf0 !important;
    color: #dd6b20 !important;
    border: 1px solid #fbd38d !important;
}

/* Interactivity / Selection Card Styles (Step 2 and 3 dynamic selections) */
.free-student-selection,
.mandatory-lesson-correction {
    background: white !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 10px !important;
    padding: 20px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02) !important;
}

.free-student-selection h4,
.mandatory-lesson-correction h4 {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #2d3748 !important;
    margin: 0 0 14px 0 !important;
    border-bottom: 1.5px solid #edf2f7 !important;
    padding-bottom: 10px !important;
}

.student-checkbox-list {
    list-style: none !important;
    margin: 12px 0 !important;
    padding: 0 !important;
    max-height: 280px !important;
    overflow-y: auto !important;
}

.student-checkbox-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 10px 14px !important;
    background: #f8fafc !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 8px !important;
    margin-bottom: 6px !important;
    transition: all 0.2s ease !important;
}

.student-checkbox-item:hover {
    background: #edf2f7 !important;
    border-color: #cbd5e0 !important;
    transform: translateY(-1px) !important;
}

.student-checkbox-item input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    accent-color: #4299e1 !important;
    cursor: pointer !important;
}

.student-checkbox-label {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #2d3748 !important;
    cursor: pointer !important;
    flex: 1 !important;
}

.student-checkbox-label small {
    font-size: 11px !important;
    color: #718096 !important;
    font-weight: 500 !important;
    margin-top: 2px;
}

/* Action Buttons inside selections */
.action-buttons {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    margin-top: 18px !important;
}

.btn-confirm-free {
    background: #48bb78 !important;
    color: white !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 6px rgba(72, 187, 120, 0.2) !important;
}

.btn-confirm-free:hover:not(:disabled) {
    background: #38a169 !important;
    box-shadow: 0 4px 10px rgba(72, 187, 120, 0.4) !important;
    transform: translateY(-1px) !important;
}

/* Mandatory Lesson Issue card item styling */
.student-issues-list {
    margin: 15px 0 !important;
    max-height: 320px !important;
    overflow-y: auto !important;
}

.student-issue-item {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 12px 14px !important;
    margin-bottom: 8px !important;
    background: #fffaf0 !important;
    border: 1.5px solid #fbd38d !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
}

.student-issue-item:hover {
    background: #fff8e1 !important;
    border-color: #f6ad55 !important;
}

.student-info {
    flex: 1 !important;
}

.student-info strong {
    color: #2d3748 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    display: block !important;
    margin-bottom: 3px !important;
}

.student-info small {
    color: #e53e3e !important;
    font-weight: 600 !important;
    font-size: 11px !important;
}

.correction-input {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 4px !important;
}

.mandatory-lesson-input {
    width: 50px !important;
    padding: 6px !important;
    border: 2px solid #4299e1 !important;
    border-radius: 6px !important;
    text-align: center !important;
    font-weight: bold !important;
    font-size: 0.9rem !important;
    background: white;
}

.mandatory-lesson-input:focus {
    outline: none !important;
    border-color: #3182ce !important;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15) !important;
}

.btn-fix-mandatory {
    background: #ed8936 !important;
    color: white !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 6px rgba(237, 137, 54, 0.2) !important;
}

.btn-fix-mandatory:hover {
    background: #dd6b20 !important;
    box-shadow: 0 4px 10px rgba(237, 137, 54, 0.4) !important;
    transform: translateY(-1px) !important;
}

.btn-skip-mandatory {
    background: #cbd5e0 !important;
    color: #4a5568 !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    transition: all 0.2s ease !important;
    margin-left: 10px !important;
}

.btn-skip-mandatory:hover {
    background: #cbd5e0 !important;
    color: #2d3748 !important;
}

/* Premium Dialog Footer */
#invoiceWorkflowModal .uk-modal-footer {
    padding: 16px 24px !important;
    background: #f8fafc !important;
    border-top: 1.5px solid #e2e8f0 !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 12px !important;
    border-radius: 0 0 12px 12px !important;
}

#invoiceWorkflowModal .uk-modal-footer .uk-button {
    font-size: 12px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    padding: 8px 20px !important;
    height: auto !important;
    line-height: 1.4 !important;
    text-transform: none !important;
    transition: all 0.2s ease !important;
}

#invoiceWorkflowModal .uk-modal-footer .uk-button-default {
    background: white !important;
    border: 1px solid #cbd5e0 !important;
    color: #4a5568 !important;
}

#invoiceWorkflowModal .uk-modal-footer .uk-button-default:hover {
    background: #edf2f7 !important;
    border-color: #a0aec0 !important;
}

#invoiceWorkflowModal .uk-modal-footer .uk-button-success {
    background: #48bb78 !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 2px 6px rgba(72, 187, 120, 0.2) !important;
}

#invoiceWorkflowModal .uk-modal-footer .uk-button-success:hover {
    background: #38a169 !important;
    box-shadow: 0 4px 10px rgba(72, 187, 120, 0.4) !important;
    transform: translateY(-1px) !important;
}

/* Pulsing and animations keyframes */
@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.35); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(66, 153, 225, 0.2); }
    100% { transform: scale(1); box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.35); }
}

/* Responsive compact viewport sizes */
@media (max-width: 1200px) {
    .workflow-panel {
        width: 250px;
        min-width: 250px;
    }
    
    .main-content-panel {
        width: calc(100% - 250px);
    }
}

@media (max-width: 900px) {
    .invoice-modal-content {
        flex-direction: column;
        overflow-y: auto;
    }
    
    .workflow-panel,
    .main-content-panel {
        width: 100% !important;
        height: auto !important;
    }
    
    .main-content-panel {
        flex-direction: column;
    }
}