/* ========================================
   PURCHASE ORDERS EXPORT STYLES
   ======================================== */

/* Page Wrapper */
.poe-wrapper {
    width: 100%;
    height: calc(100vh - 60px);
    overflow: hidden;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    position: relative;
}

.poe-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
    position: relative;
    z-index: var(--z-base);
}

.poe-container::-webkit-scrollbar {
    width: 4px;
}

.poe-container::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.poe-container::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: var(--radius-md);
}

/* ========================================
   HEADER SECTION
   ======================================== */

.poe-header {
    background: var(--surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--space-lg) var(--space-xl);
    margin: var(--space-lg) var(--space-xl) 0 var(--space-xl);
    position: relative;
    box-shadow: var(--shadow-sm);
}

.poe-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-primary);
}

.poe-header-content {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.poe-header-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--accent-primary);
}

.poe-header-text {
    flex: 1;
}

.poe-title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: var(--text-2xl);
    font-weight: var(--font-medium);
    color: var(--text-primary);
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-tight);
}

.poe-subtitle {
    margin: 4px 0 0 0;
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: var(--font-regular);
    letter-spacing: var(--tracking-normal);
}

/* ========================================
   CONTENT AREA
   ======================================== */

.poe-content {
    padding: var(--space-lg) var(--space-xl);
}

/* ========================================
   LOADING SPINNER
   ======================================== */

.poe-loader-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-dark);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    animation: fadeIn var(--transition-base) ease-out;
}

.poe-loader {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.poe-loader-ring {
    position: absolute;
    border: 3px solid transparent;
    border-radius: var(--radius-full);
    border-top-color: var(--accent-primary);
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.poe-loader-ring:nth-child(1) {
    width: 90px;
    height: 90px;
    animation-delay: -0.45s;
}

.poe-loader-ring:nth-child(2) {
    width: 70px;
    height: 70px;
    animation-delay: -0.3s;
    border-top-color: var(--accent-secondary);
}

.poe-loader-ring:nth-child(3) {
    width: 50px;
    height: 50px;
    animation-delay: -0.15s;
    border-top-color: var(--info);
}

.poe-loader-text {
    margin-top: 140px;
    color: white;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    letter-spacing: var(--tracking-wider);
    animation: pulse 1.5s ease-in-out infinite;
}

/* ========================================
   SECTIONS/CARDS
   ======================================== */

.poe-section {
    background: var(--surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-slow);
}

.poe-section:hover {
    box-shadow: var(--shadow-md);
}

.poe-section-title {
    margin: 0 0 var(--space-lg) 0;
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--accent-primary);
    font-family: var(--font-sans);
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    letter-spacing: var(--tracking-wide);
}

.poe-section-title i {
    color: var(--accent-primary);
    font-size: 18px;
}

/* ========================================
   FORM CONTROLS
   ======================================== */

.poe-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.poe-form-label {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    letter-spacing: var(--tracking-wide);
}

.poe-select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--text-body);
    background: var(--surface);
    transition: all var(--transition-base);
    cursor: pointer;
}

.poe-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ========================================
   EXPORT TYPE BUTTONS
   ======================================== */

.poe-type-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.poe-type-btn {
    background: var(--surface);
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    text-align: center;
}

.poe-type-btn:hover {
    border-color: var(--accent-primary);
    background: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.poe-type-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.poe-type-btn.active .poe-type-icon {
    color: white;
}

.poe-type-btn.active .poe-type-label,
.poe-type-btn.active .poe-type-desc {
    color: white;
}

.poe-type-icon {
    font-size: 32px;
    color: var(--accent-primary);
    transition: color var(--transition-base);
}

.poe-type-label {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    transition: color var(--transition-base);
}

.poe-type-desc {
    font-size: var(--text-xs);
    color: var(--text-muted);
    transition: color var(--transition-base);
}

/* Custom Selection Button */
.poe-custom-btn {
    width: 100%;
    background: var(--surface);
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    font-family: var(--font-sans);
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    color: var(--text-body);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
}

.poe-custom-btn:hover {
    border-color: var(--accent-primary);
    background: var(--accent-light);
}

.poe-custom-btn.active {
    background: var(--warning);
    border-color: var(--warning);
    color: white;
}

/* ========================================
   CUSTOM STATUS SELECTION
   ======================================== */

.poe-custom-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-top: var(--space-lg);
}

.poe-custom-title {
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

.poe-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md);
}

.poe-checkbox-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.poe-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.poe-checkbox-item label {
    font-size: var(--text-sm);
    color: var(--text-body);
    cursor: pointer;
    margin: 0;
}

/* ========================================
   INFO ALERT
   ======================================== */

.poe-alert {
    background: var(--accent-light);
    border: 1px solid var(--accent-15);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

.poe-alert-icon {
    color: var(--info);
    font-size: 18px;
}

.poe-alert-content {
    flex: 1;
}

.poe-alert-title {
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin: 0 0 4px 0;
    font-size: var(--text-sm);
}

.poe-alert-text {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin: 0;
}

/* ========================================
   PERIOD SELECTION
   ======================================== */

.poe-period-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.poe-period-btn {
    background: var(--surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-sans);
    font-weight: var(--font-medium);
    font-size: var(--text-xs);
    color: var(--text-body);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
    white-space: nowrap;
}

.poe-period-btn:hover {
    border-color: var(--accent-primary);
    background: var(--accent-light);
}

.poe-period-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.poe-date-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

.poe-help-text {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* ========================================
   ACTION BUTTONS
   ======================================== */

.poe-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
    margin-top: var(--space-lg);
}

.poe-btn {
    background: var(--surface);
    color: var(--text-body);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 10px 22px;
    font-family: var(--font-sans);
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.poe-btn:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.poe-btn-primary {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.poe-btn-primary:hover {
    background: var(--accent-secondary);
    box-shadow: 0 4px 16px rgba(255, 0, 131, 0.15);
}

.poe-btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.poe-btn-success:hover {
    background: #2AD5BD;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15);
}

.poe-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ========================================
   TABLES
   ======================================== */

.poe-table-wrapper {
    overflow-x: auto;
    margin-top: var(--space-lg);
}

.poe-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.poe-table thead tr {
    border-bottom: 2px solid var(--border-primary);
}

.poe-table th {
    padding: var(--space-md) var(--space-sm);
    text-align: left;
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    background: var(--bg-secondary);
}

.poe-table tbody tr {
    border-bottom: 1px solid var(--border-secondary);
    transition: background var(--transition-fast);
}

.poe-table tbody tr:hover {
    background: var(--bg-secondary);
}

.poe-table td {
    padding: var(--space-md) var(--space-sm);
    color: var(--text-body);
    font-variant-numeric: tabular-nums;
}

/* Empty State */
.poe-empty {
    text-align: center;
    padding: var(--space-3xl);
    color: var(--text-muted);
}

.poe-empty i {
    font-size: 48px;
    color: var(--border-secondary);
    margin-bottom: var(--space-lg);
}

.poe-empty h3 {
    font-size: var(--text-xl);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.poe-empty p {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* ========================================
   PREVIEW STATISTICS
   ======================================== */

.poe-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.poe-stat-card {
    background: var(--surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.poe-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-primary);
}

.poe-stat-card.primary::before { background: var(--accent-primary); }
.poe-stat-card.success::before { background: var(--success); }
.poe-stat-card.warning::before { background: var(--warning); }
.poe-stat-card.info::before { background: var(--info); }

.poe-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.poe-stat-title {
    font-size: var(--text-sm);
    color: var(--accent-primary);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
}

.poe-stat-title.success { color: var(--success); }
.poe-stat-title.warning { color: var(--warning); }
.poe-stat-title.info { color: var(--info); }

.poe-stat-value {
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-xs);
}

.poe-stat-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ========================================
   STATUS DISTRIBUTION
   ======================================== */

.poe-distribution-section {
    background: var(--surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-sm);
}

.poe-distribution-header {
    background: var(--bg-secondary);
    padding: var(--space-md) var(--space-lg);
    margin: calc(var(--space-xl) * -1) calc(var(--space-xl) * -1) var(--space-lg);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border-bottom: 2px solid var(--border-primary);
}

.poe-distribution-title {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.poe-progress-bar-wrapper {
    position: relative;
    width: 100%;
    height: 25px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.poe-progress-bar {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: white;
    transition: width var(--transition-slow);
}

.poe-progress-bar.warning { background: var(--warning); }
.poe-progress-bar.info { background: var(--info); }
.poe-progress-bar.primary { background: var(--accent-primary); }
.poe-progress-bar.success { background: var(--success); }
.poe-progress-bar.secondary { background: var(--text-muted); }

/* ========================================
   TOP LISTS (AREAS/GL ACCOUNTS)
   ======================================== */

.poe-top-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.poe-top-card {
    background: var(--surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.poe-top-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 2px solid var(--border-primary);
}

.poe-top-header.warning {
    background: var(--warning);
    color: white;
}

.poe-top-header.info {
    background: var(--info);
    color: white;
}

.poe-top-title {
    margin: 0;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.poe-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.poe-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-secondary);
    transition: background var(--transition-fast);
}

.poe-list-item:last-child {
    border-bottom: none;
}

.poe-list-item:hover {
    background: var(--bg-secondary);
}

.poe-list-content {
    flex: 1;
}

.poe-list-title {
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    font-size: var(--text-sm);
    margin: 0 0 4px 0;
}

.poe-list-subtitle {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.poe-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    font-variant-numeric: tabular-nums;
}

.poe-badge.warning {
    background: var(--warning);
    color: white;
}

.poe-badge.info {
    background: var(--info);
    color: white;
}

.poe-badge.success {
    background: var(--success);
    color: white;
}

.poe-badge.primary {
    background: var(--accent-primary);
    color: white;
}

/* ========================================
   EXPORT FEATURES
   ======================================== */

.poe-features-section {
    background: var(--surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-sm);
}

.poe-features-header {
    background: var(--text-primary);
    color: white;
    padding: var(--space-md) var(--space-lg);
    margin: calc(var(--space-xl) * -1) calc(var(--space-xl) * -1) var(--space-lg);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.poe-features-title {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.poe-features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
}

.poe-feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.poe-feature-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-sm);
    color: var(--text-body);
}

.poe-feature-item i {
    color: var(--success);
}

/* ========================================
   EXPORT ACTIONS
   ======================================== */

.poe-actions-section {
    background: var(--surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
}

.poe-btn-group {
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
    align-items: center;
}

.poe-btn-lg {
    padding: 14px 28px;
    font-size: var(--text-base);
}

/* Loading Spinner */
.poe-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1200px) {
    .poe-type-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .poe-stats-grid,
    .poe-top-grid {
        grid-template-columns: 1fr;
    }

    .poe-features-grid {
        grid-template-columns: 1fr;
    }

    .poe-period-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .poe-date-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .poe-header {
        padding: var(--space-md) var(--space-lg);
        margin: var(--space-md) var(--space-lg) 0 var(--space-lg);
    }

    .poe-title {
        font-size: var(--text-xl);
    }

    .poe-subtitle {
        font-size: var(--text-xs);
    }

    .poe-content {
        padding: var(--space-md) var(--space-lg);
    }

    .poe-type-grid {
        grid-template-columns: 1fr;
    }

    .poe-checkbox-grid {
        grid-template-columns: 1fr;
    }

    .poe-period-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .poe-btn-group {
        flex-direction: column;
    }

    .poe-btn {
        width: 100%;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
