/**
 * Lists Management Common Styles
 * Hierarchical tab navigation and shared component styles
 */

/* Container */
#lists-management-container {
    min-height: 600px;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
}

/* Main Tab Navigation */
.lm-main-tabs {
    background: #2c3e50;
    padding: 0;
    display: flex;
    border-bottom: 3px solid #34495e;
}

.lm-main-tab-button {
    background: none;
    border: none;
    color: #ecf0f1;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 0;
}

.lm-main-tab-button:hover {
    background: #34495e;
}

.lm-main-tab-button.active {
    background: #3498db;
    color: white;
}

.lm-main-tab-button i {
    font-size: 20px;
}

/* Sub-Tab Navigation */
.lm-sub-tabs-container {
    background: white;
    border-bottom: 1px solid #ddd;
    min-height: 48px;
}

.lm-sub-tabs {
    display: none;
    padding: 0;
}

.lm-sub-tabs.active {
    display: flex;
}

.lm-sub-tab-button {
    background: none;
    border: none;
    color: #555;
    padding: 12px 24px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}

.lm-sub-tab-button:hover {
    color: #333;
    background: #f8f9fa;
}

.lm-sub-tab-button.active {
    color: #3498db;
    border-bottom-color: #3498db;
    font-weight: 600;
}

/* Content Container */
.lm-content-container {
    background: white;
    padding: 20px;
    min-height: 500px;
}

.lm-main-content {
    display: none;
}

.lm-main-content.active {
    display: block;
}

.lm-sub-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.lm-sub-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section Headers */
.lm-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.lm-section-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 24px;
}

/* Buttons */
.lm-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.lm-button-primary {
    background: #3498db;
    color: white;
}

.lm-button-primary:hover {
    background: #2980b9;
}

.lm-button-secondary {
    background: #95a5a6;
    color: white;
}

.lm-button-secondary:hover {
    background: #7f8c8d;
}

.lm-button-danger {
    background: #e74c3c;
    color: white;
}

.lm-button-danger:hover {
    background: #c0392b;
}

/* Tables */
.lm-table-container {
    overflow-x: auto;
}

.lm-table {
    width: 100%;
    margin-bottom: 1rem;
}

/* Modal */
.lm-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.lm-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.lm-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    padding: 10px 20px;
    cursor: pointer;
}

.lm-modal-close:hover,
.lm-modal-close:focus {
    color: black;
}

#lm-modal-body {
    padding: 20px;
}

/* Placeholder for Coming Soon */
.lm-placeholder {
    text-align: center;
    padding: 80px 20px;
    color: #7f8c8d;
}

.lm-placeholder i {
    font-size: 64px;
    margin-bottom: 20px;
    display: block;
    color: #bdc3c7;
}

.lm-placeholder h3 {
    color: #7f8c8d;
    margin-bottom: 10px;
}

/* Loading States */
.lm-loading {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.lm-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Error Messages */
.lm-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Success Messages */
.lm-success {
    background: #efe;
    border: 1px solid #cfc;
    color: #3c763d;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Info Messages */
.lm-info {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    color: #1976d2;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Report Assignments */
.rlm-assignments-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.rlm-available-reports,
.rlm-assigned-reports {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    background: #f8f9fa;
}

.rlm-available-reports h5,
.rlm-assigned-reports h5 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #495057;
    font-size: 18px;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 10px;
}

.rlm-reports-list {
    max-height: 400px;
    overflow-y: auto;
}

.rlm-report-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.rlm-report-item:hover {
    border-color: #80bdff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.rlm-report-info {
    flex: 1;
}

.rlm-schedule-info {
    background: #e9ecef;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.rlm-schedule-details {
    margin: 0;
}

/* Legacy classes for backward compatibility */
.rlm-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.rlm-button-primary {
    background: #007bff;
    color: white;
}

.rlm-button-primary:hover {
    background: #0056b3;
}

.rlm-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.rlm-section-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 24px;
}

.rlm-table-container {
    overflow-x: auto;
}

.rlm-loading {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.rlm-error {
    background: #fee;
    color: #c33;
    padding: 15px;
    text-align: center;
}

.rlm-info {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    color: #1976d2;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .lm-main-tab-button {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .lm-main-tab-button i {
        font-size: 18px;
    }
    
    .lm-sub-tab-button {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .lm-section-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .lm-modal-content {
        width: 95%;
        margin: 10% auto;
    }
} 

/* Ensure tables use full available width */
.lm-table-container table {
    width: 100%;
    max-width: none;
}

/* Adjust content padding for full-width layout */
.lm-content-container {
    padding: 20px;
    max-width: none;
}

/* Responsive adjustments */
@media (min-width: 769px) {
    #lists-management-container {
        padding: 30px;
    }
    
    .lm-content-container {
        padding: 30px;
    }
}

/* Full-width layout - WordPress compatible approach */
.entry-content #lists-management-container {
    margin-left: calc(-1 * var(--wp--style--root--padding-left, 2rem));
    margin-right: calc(-1 * var(--wp--style--root--padding-right, 2rem));
    width: auto;
    max-width: none;
}

/* Alternative full-width for themes without CSS variables */
@supports not (--wp--style--root--padding-left: 1rem) {
    .entry-content #lists-management-container {
        width: 100vw;
        position: relative;
        left: 50%;
        transform: translateX(-50%);
        max-width: 100vw;
    }
}

/* Ensure no horizontal scroll */
body {
    overflow-x: hidden;
}

/* Container padding adjustment */
#lists-management-container {
    padding: 20px;
    box-sizing: border-box;
}

/* Table responsiveness */
.lm-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.lm-table-container table {
    width: 100%;
    min-width: 800px;
}

/* Content area full width */
.lm-content-container {
    max-width: none;
    width: 100%;
}

/* Responsive padding */
@media (min-width: 1200px) {
    #lists-management-container {
        padding: 30px 40px;
    }
}

@media (max-width: 768px) {
    #lists-management-container {
        padding: 15px;
    }
    
    .lm-table-container table {
        min-width: 600px;
    }
}
