/**
 * ShopGlut PDF Invoices Admin Styles
 * Fixes for admin page styling issues
 */

/* Main wrapper fixes */
.shopglut-pdf-invoices-wrapper {
    max-width: 1200px;
    margin: 20px 0;
    background: #fff;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

/* Navigation fixes */
.shopglut-pdf-invoices-wrapper .nav-tab-wrapper {
    border-bottom: 1px solid #ccd0d4;
    padding: 0;
    margin: 0 0 20px 0;
}

.shopglut-pdf-invoices-wrapper .nav-tab {
    position: relative;
    display: inline-block;
    padding: 8px 12px;
    margin: 0;
    text-decoration: none;
    border: 1px solid transparent;
    border-bottom: none;
    background: #f1f1f1;
    color: #0073aa;
}

.shopglut-pdf-invoices-wrapper .nav-tab:hover {
    background: #fafafa;
    color: #0073aa;
}

.shopglut-pdf-invoices-wrapper .nav-tab.nav-tab-active {
    background: #fff;
    border-color: #ccd0d4 #ccd0d4 #fff;
    color: #000;
}

/* Content area fixes */
.nav-tab-content {
    padding: 20px;
    background: #fff;
    min-height: 400px;
}

/* Dashboard specific fixes */
.shopglut-pdf-dashboard {
    max-width: 100%;
    margin: 0;
}

.dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 30px;
    color: white;
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.header-icon i {
    font-size: 48px;
    opacity: 0.8;
}

.header-info h1 {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 600;
    color: white;
}

.header-info p {
    margin: 0;
    opacity: 0.9;
    font-size: 16px;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-card.invoices .stat-icon {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
}

.stat-card.packing-slips .stat-icon {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
}

.stat-card.downloads .stat-icon {
    background: linear-gradient(135deg, #45b7d1, #2196f3);
}

.stat-card.storage .stat-icon {
    background: linear-gradient(135deg, #96c93d, #4caf50);
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #2c3e50;
}

.stat-label {
    color: #7f8c8d;
    font-size: 14px;
    margin-bottom: 8px;
}

.stat-change {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.positive {
    color: #27ae60;
}

.stat-change.neutral {
    color: #95a5a6;
}

/* Dashboard grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.dashboard-panel {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.panel-header {
    background: #f8f9fa;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-content {
    padding: 20px;
}

/* Action buttons */
.action-buttons {
    display: grid;
    gap: 12px;
}

.action-button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: #0073aa;
    transition: all 0.2s ease;
}

.action-button:hover {
    background: #f0f6fc;
    border-color: #0073aa;
    color: #0073aa;
    text-decoration: none;
}

.action-button.primary {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.action-button.primary:hover {
    background: #005177;
    color: white;
}

/* Feature grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
    font-size: 13px;
}

.feature-item.enabled {
    background: #f0f8f0;
    border-color: #27ae60;
    color: #27ae60;
}

.feature-item.disabled {
    background: #f8f8f8;
    color: #95a5a6;
}

.feature-item i {
    font-size: 20px;
}

/* Documents page specific */
.shopglut-documents-page {
    max-width: 100%;
    margin: 0;
}

.documents-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 30px;
    color: white;
    margin-bottom: 30px;
    position: relative;
}

.documents-header .header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
}

.documents-header .header-info h1 {
    color: white;
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 600;
}

.documents-header .header-info p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-size: 16px;
}

.documents-header .header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.documents-header .header-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.documents-header .header-actions .button-primary {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.documents-header .header-actions .button-primary:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.documents-header .header-actions .button-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.documents-header .header-actions .button-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.documents-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

.stat-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.stat-item .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
}

.stat-item .stat-icon.invoices {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
}

.stat-item .stat-icon.packing-slips {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
}

.stat-item .stat-icon.ubl {
    background: linear-gradient(135deg, #45b7d1, #2196f3);
}

.stat-item .stat-icon.storage {
    background: linear-gradient(135deg, #96c93d, #4caf50);
}

.stat-item .stat-content {
    flex: 1;
}

.stat-item .stat-number {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #2c3e50;
}

.stat-item .stat-label {
    color: #7f8c8d;
    font-size: 14px;
    margin: 0;
}

/* Documents Filters */
.documents-filters {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.filters-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 150px;
}

.filter-group.search-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.filter-group select,
.filter-group input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.filter-group select:focus,
.filter-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: end;
}

.filter-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 14px;
}

/* Documents Table Container */
.documents-table-container {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

/* No Documents State */
.no-documents {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.no-documents-icon {
    margin-bottom: 20px;
}

.no-documents-icon i {
    font-size: 64px;
    color: #d1d5db;
}

.no-documents h3 {
    font-size: 24px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 12px 0;
}

.no-documents p {
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 30px 0;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.no-documents-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.no-documents-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 16px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.no-documents-actions .button-primary {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.no-documents-actions .button-primary:hover {
    background: #5a67d8;
    border-color: #5a67d8;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.no-documents-actions .button-secondary {
    background: #fff;
    border: 1px solid #d1d5db;
    color: #374151;
}

.no-documents-actions .button-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
    text-decoration: none;
}

/* Fix notice positioning in documents header */
.documents-header .header-info .notice {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 10px;
    z-index: 10;
    border-radius: 6px;
}

.documents-header .header-info .notice[style*="display: none"] {
    display: none !important;
}

/* Documents table styling when there are documents */
.documents-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.documents-table th,
.documents-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.documents-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.documents-table tbody tr:hover {
    background: #f8f9fa;
}

.documents-table .document-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.documents-table .document-actions .button {
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1.4;
}

.document-checkbox {
    margin: 0;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.completed {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.processing {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.pending {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.on-hold {
    background: #dbeafe;
    color: #1e40af;
}

/* Pagination */
.documents-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
}

.documents-stats-summary {
    color: #6b7280;
    font-size: 14px;
}

.pagination-links {
    display: flex;
    gap: 6px;
    align-items: center;
}

.pagination-links .button {
    padding: 6px 12px;
    font-size: 14px;
    text-decoration: none;
    border-radius: 4px;
}

.pagination-links .button.current {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.pagination-links .button:not(.current):hover {
    background: #f3f4f6;
}

/* Bulk actions bar */
.bulk-actions-bar {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.bulk-actions-bar.hidden {
    display: none;
}

.bulk-selection-info {
    font-size: 14px;
    color: #374151;
}

.bulk-selection-info strong {
    color: #667eea;
}

/* Settings content */
.settings-content {
    max-width: 100%;
}

.settings-nav {
    margin-bottom: 20px;
}

.settings-nav-tabs {
    border-bottom: 1px solid #ccd0d4;
}

.agshopglut-settings-wrapper {
    background: #fff;
    padding: 0;
}

/* Responsive fixes */
@media (max-width: 768px) {
    .header-content,
    .documents-header .header-content {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }
    
    .stats-grid,
    .documents-stats {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .filter-actions {
        justify-content: center;
    }
    
    .no-documents-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .documents-table {
        font-size: 14px;
    }
    
    .documents-table th,
    .documents-table td {
        padding: 8px 12px;
    }
}

/* Fix for AGSHOPGLUT framework conflicts */
.shopglut-pdf-invoices-wrapper .agshopglut {
    max-width: none !important;
}

.shopglut-pdf-invoices-wrapper .agshopglut .agshopglut-wrapper {
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
}

.shopglut-pdf-invoices-wrapper .agshopglut .agshopglut-header {
    display: none !important;
}

.shopglut-pdf-invoices-wrapper .agshopglut .agshopglut-nav {
    margin: 0 !important;
    border-bottom: 1px solid #ccd0d4 !important;
}

.shopglut-pdf-invoices-wrapper .agshopglut .agshopglut-content {
    padding: 20px !important;
    background: #fff !important;
}

/* Status badge fixes */
.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.status-badge.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.status-badge.inactive {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

/* Notice improvements */
.notice {
    margin: 20px 0;
}

/* Pro upgrade styling fixes */
.pro-tab-preview {
    position: relative;
}

.pro-upgrade-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    z-index: 10;
}

.pro-upgrade-content {
    text-align: center;
    padding: 40px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-width: 400px;
}

/* Support sections */
.support-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.support-section {
    background: #f9f9f9;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.support-section h3 {
    margin-top: 0;
    color: #0073aa;
}

/* Button improvements */
.button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.button i {
    font-size: 14px;
}

/* Clear floats and general cleanup */
.shopglut-pdf-invoices-wrapper::after {
    content: "";
    display: table;
    clear: both;
}

/* Accessibility improvements */
.nav-tab:focus {
    box-shadow: 0 0 0 2px #0073aa;
    outline: none;
}

.action-button:focus {
    box-shadow: 0 0 0 2px #0073aa;
    outline: none;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}