/**
 * Contract Portal Frontend Styles
 */

.contract-portal-container {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Admin Dashboard Styles */
.cp-dashboard-layout {
    display: block;
    margin-top: 20px;
}

.cp-dashboard-main {
    width: 100%;
    margin-bottom: 20px;
}

.cp-dashboard-sidebar {
    width: 100%;
}

.cp-dashboard-main .card,
.cp-dashboard-sidebar .card {
    margin-bottom: 20px;
}



/* Layout toggle button */
.layout-toggle {
    margin-bottom: 20px;
    text-align: right;
}

.layout-toggle button {
    padding: 8px 15px;
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    margin-left: 10px;
}

.layout-toggle button:hover {
    background-color: #005177;
}

/* Add a specific style for the status toggle button */
#toggle-status {
    background-color: #4CAF50;
}

#toggle-status:hover {
    background-color: #388E3C;
}

/* Card View Styles */
.card-view {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.card-view .contract-item {
    position: relative;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.card-view .contract-status {
    position: absolute;
    top: 10px;
    right: 10px;
}

.card-view .contract-title {
    margin-top: 0;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    font-size: 1.4em;
}

.card-view .contract-content {
    margin-bottom: 15px;
}

.card-view .contract-meta {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1.5fr;
    gap: 10px;
    margin-bottom: 15px;
}

.card-view .meta-item {
    margin-bottom: 8px;
}

.card-view .meta-label {
    font-weight: bold;
    display: block;
    margin-bottom: 3px;
    color: #666;
}

.card-view .meta-value {
    color: #333;
}

.card-view .contract-downloads {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.card-view .contract-downloads h4 {
    margin: 0 0 10px 0;
    font-size: 1em;
}

.card-view .contract-downloads ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.card-view .contract-downloads li {
    margin-bottom: 5px;
}

.card-view .contract-downloads a {
    display: inline-block;
    padding: 5px 10px;
    background-color: #0073aa;
    color: white;
    border-radius: 3px;
    text-decoration: none;
    font-size: 0.9em;
}

.card-view .contract-downloads a:hover {
    background-color: #005177;
}

/* List View Styles */
.list-view {
    border: 1px solid #eee;
    border-radius: 5px;
    overflow: hidden;
}

.list-view-header,
.contract-list-header {
    padding: 12px 15px;
    background-color: #f1f1f1;
    border-bottom: 1px solid #eee;
    font-weight: bold;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr;
    align-items: center;
    gap: 15px;
}

/* Ensure header is hidden in card view */
.card-view .list-view-header {
    display: none !important;
}

.list-view .contract-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    background-color: #fff;
    transition: background-color 0.2s;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr;
    align-items: center;
    gap: 15px;
    position: relative;
}

.list-view .contract-item:last-child {
    border-bottom: none;
}

.list-view .contract-item:hover {
    background-color: #f5f5f5;
}

.list-view .contract-status {
    display: block;
    position:absolute;
    bottom: 15px;
    right: 15px;
}

.list-view .contract-title {
    margin: 0;
    padding: 0;
    border: none;
}

.list-view .contract-title h3 {
    margin: 0 0 10px 0;
    font-size: 1em;
}

.list-view .contract-title a {
    color: #0073aa;
    text-decoration: none;
}

.list-view .contract-title a:hover {
    text-decoration: underline;
}

.list-view .contract-content {
    display: none;
}

.list-view .contract-meta {
    display: contents;
}

.list-view .meta-item {
    margin: 0;
}

.list-view .meta-label {
    display: none;
}

.list-view .meta-value {
    color: #333;
}

.list-view .header-status {
    text-align: center;
}

.list-view .header-status.current-contract,
.list-view .header-status.past-contract {
    width: fit-content;
    padding: 3px 8px;
    text-align: center;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 600;
}

.list-view .header-status.current-contract {
    background-color: #e6f7e6;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.list-view .header-status.past-contract {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.list-view .contract-downloads {
    margin: 0;
    padding: 0;
    border: none;
}

.list-view .contract-downloads h4 {
    display: none;
}

.list-view .contract-downloads ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list-view .contract-downloads li {
    margin: 0;
    display: inline-block;
}

.list-view .contract-downloads a {
    display: inline-block;
    padding: 3px 8px;
    background-color: #0073aa;
    color: white;
    border-radius: 3px;
    text-decoration: none;
    font-size: 0.9em;
    margin-right: 5px;
}

.list-view .contract-downloads a:hover {
    background-color: #005177;
    text-decoration: none;
}

.list-view .contract-button {
    display: inline-block;
    padding: 6px 12px;
    background-color: #0073aa;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s ease;
} 

.list-view .contract-button:hover {
    background-color: #005177;
    text-decoration: none;
}

/* Status Labels */
.contract-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 600;
    text-align: center;
}

.contract-status.current {
    background-color: #e6f7e6;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.contract-status.past {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* Filter Styles */
.contract-portal-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 200px;
}

.filter-group label {
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 14px;
}

.contract-filter {
    padding: 8px 12px;
    border: 1px solid #eee;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    min-width: 200px;
}

.contract-filter:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Results Count */
.contract-results-count {
    margin: 15px 0;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    font-size: 14px;
    color: #555;
}

.contract-results-count strong {
    color: #333;
    font-weight: 600;
}

/* Pagination Styles */
.contract-pagination {
    margin-top: 30px;
    text-align: center;
}

.contract-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 3px;
    border: 1px solid #eee;
    border-radius: 3px;
    background-color: #fff;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
}

.contract-pagination .page-numbers:hover {
    background-color: #f5f5f5;
    text-decoration: none;
}

.contract-pagination .page-numbers.current {
    background-color: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.contract-pagination .prev,
.contract-pagination .next {
    padding: 8px 15px;
}

/* No contracts message */
.no-filtered-contracts {
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-top: 20px;
    text-align: center;
}

.no-contracts-message {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
    text-align: center;
    font-size: 16px;
    color: #6c757d;
}

.no-contracts-message .reset-industry-filter {
    color: #007bff;
    text-decoration: underline;
    margin-left: 5px;
    cursor: pointer;
}

.no-contracts-message .reset-industry-filter:hover {
    color: #0056b3;
    text-decoration: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-view .contract-meta {
        grid-template-columns: 1fr;
    }
    
    .contract-portal-filters {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .contract-filter {
        width: 100%;
    }
}

/* No contracts message */
.no-contracts {
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 5px;
    text-align: center;
    color: #666;
}

/* Contract Status Badge */
.contract-status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contract-status-badge.current {
    background-color: #e6f7e6;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.contract-status-badge.past {
    background-color: #f5f5f5;
    color: #757575;
    border: 1px solid #eee;
}

/* Button Styles */
.contract-button {
    display: inline-block;
    padding: 6px 12px;
    background-color: #0073aa;
    color: white !important;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.contract-button:hover {
    background-color: #005177;
    text-decoration: none !important;
}

/* .contract-more {
    display: inline-block;
    padding: 6px 12px;
    background-color: #0073aa;
    color: white !important;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 15px;
}

.contract-more:hover {
    background-color: #005177;
    text-decoration: none !important;
} */

.contract-actions {
    margin-top: 15px;
}

/* Loading indicator for AJAX requests */

/* Loading state */
.contracts-wrapper.loading {
    position: relative;
    min-height: 200px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.contracts-wrapper.loading:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    margin: -25px 0 0 -25px;
    border: 3px solid rgba(0, 115, 170, 0.2);
    border-radius: 50%;
    border-top-color: #0073aa;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Transition effect for showing/hiding content */
.contracts-wrapper {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.contract-portal-filters.loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.contract-portal-filters.loading:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.contracts-wrapper.loading:after {
    display: none;
}

/* Pagination spinner */
.pagination-loading-indicator {
    display: none;
    position: relative;
    height: 40px;
    margin-bottom: 15px;
    text-align: center;
}

.pagination-loading-indicator:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(0, 115, 170, 0.2);
    border-radius: 50%;
    border-top-color: #0073aa;
    animation: spin 1s ease-in-out infinite;
}

.pagination-loading-indicator.active {
    display: block;
}

/* Responsive styles for list view */
@media (max-width: 768px) {
    .list-view-header {
        display: none;
    }
    
    .list-view .contract-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .list-view .contract-list-item {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .list-view .header-organisation:before,
    .list-view .header-value:before,
    .list-view .header-start:before,
    .list-view .header-end:before,
    .list-view .header-industry:before {
        content: attr(class);
        display: block;
        font-weight: bold;
        text-transform: capitalize;
        margin-bottom: 5px;
    }
    
    .list-view .header-organisation:before { content: "Organisation"; }
    .list-view .header-value:before { content: "Value"; }
    .list-view .header-start:before { content: "Start Date"; }
    .list-view .header-end:before { content: "End Date"; }
    .list-view .header-industry:before { content: "Industry"; }
    
    .list-view .header-actions {
        text-align: center;
        margin-top: 10px;
    }
}
