/*
// Version: 20250103-000000
// File: includes/rank-system/assets/css/rank.css
// Purpose: Styling for rank history modals and components
*/

/* ===== RANK MODAL STYLES ===== */

/* Modal Container */
.rank-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    padding: 20px;
    box-sizing: border-box;
}

/* Modal Content */
.rank-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    max-height: 80vh;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    font-family: 'Poppins', sans-serif;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Modal Header */
.rank-modal-header {
    background: linear-gradient(135deg, #E0457B 0%, #0ABAB5 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
    flex-shrink: 0;
}

.rank-modal-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rank-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.rank-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Modal Body */
.rank-modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    background: #ffffff;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

/* ===== FILTERS ===== */

.rank-filters {
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.filter-row {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #2c3e50;
    cursor: pointer;
}

.filter-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #E0457B;
    cursor: pointer;
}

/* Toggle Switch Styles */
.filter-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Poppins', sans-serif;
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #E0457B;
    transition: 0.3s;
    border-radius: 30px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #0ABAB5;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(30px);
}

.toggle-switch:hover .toggle-slider {
    box-shadow: 0 0 8px rgba(224, 69, 123, 0.3);
}

.toggle-switch input:checked:hover .toggle-slider {
    box-shadow: 0 0 8px rgba(10, 186, 181, 0.3);
}

/* Info Button */
.rank-info-btn {
    background: #E0457B;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    font-weight: bold;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(224, 69, 123, 0.3);
    text-decoration: none;
}

.rank-info-btn:hover {
    background: #c73869;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(224, 69, 123, 0.4);
}

.rank-info-btn::before {
    content: "i";
    color: white;
    font-weight: bold;
    font-size: 18px;
}

/* ===== TABLE STYLES ===== */

.rank-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.rank-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
}

.rank-table thead {
    background: #f8f9fa;
}

.rank-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.rank-table th:nth-child(2),
.rank-table th:nth-child(3) {
    text-align: right;
}

.rank-table th:nth-child(4) {
    text-align: center;
}

.rank-table td {
    padding: 12px;
    border-bottom: 1px solid #f1f2f6;
    vertical-align: middle;
}

.rank-table tbody tr:hover {
    background: #f8f9fa;
}

.sales-cell {
    text-align: right;
}

.sales-amount {
    color: #E0457B;
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s ease;
}

.sales-amount:hover {
    color: #c73869;
    text-decoration: none;
}

.sales-cell.no-sales {
    color: #6c757d;
    font-style: italic;
}

.lifetime-sales-cell {
    text-align: right;
    font-weight: 500;
    color: #2c3e50;
}

.rank-cell {
    text-align: center;
    font-weight: 600;
    color: #2c3e50;
}

/* ===== RANK RULES MODAL ===== */

.rank-rules-container {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.rank-rules-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
}

.rank-rules-table thead {
    background: #f8f9fa;
}

.rank-rules-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.rank-rules-table th:nth-child(1) {
    text-align: center;
}

.rank-rules-table th:nth-child(2) {
    text-align: right;
}

.rank-rules-table td {
    padding: 12px;
    border-bottom: 1px solid #f1f2f6;
    vertical-align: middle;
}

.rank-rules-table tbody tr:hover {
    background: #f8f9fa;
}

.rank-rules-table .rank-cell {
    text-align: center;
    font-weight: 600;
    color: #2c3e50;
}

.rank-rules-table .threshold-cell {
    text-align: right;
    font-weight: 500;
    color: #2c3e50;
}

/* ===== PAGINATION ===== */

.rank-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.rank-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    background: #fff;
    color: #2c3e50;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.rank-page-btn:hover {
    border-color: #E0457B;
    color: #E0457B;
    transform: translateY(-1px);
}

.rank-page-btn.active {
    background: #E0457B;
    border-color: #E0457B;
    color: white;
    box-shadow: 0 2px 8px rgba(224, 69, 123, 0.3);
}

.rank-page-ellipsis {
    padding: 0 8px;
    color: #6c757d;
    font-weight: 500;
}

/* ===== WEEK DETAILS MODAL ===== */

.week-details-header {
    margin-bottom: 20px;
    text-align: center;
}

.week-details-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

.week-orders-container {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.week-orders-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
}

.week-orders-table thead {
    background: #f8f9fa;
}

.week-orders-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.week-orders-table th:nth-child(3) {
    text-align: right;
}

.week-orders-table td {
    padding: 12px;
    border-bottom: 1px solid #f1f2f6;
    vertical-align: middle;
}

.week-orders-table tbody tr:hover {
    background: #f8f9fa;
}

.amount-cell {
    text-align: right;
    font-weight: 600;
    color: #2c3e50;
}

.no-orders-message {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
}

/* ===== MODAL ACTIONS ===== */

.rank-modal-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.rank-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
    min-width: 120px;
}

.rank-btn-primary {
    background: #E0457B;
    color: white;
    box-shadow: 0 2px 8px rgba(224, 69, 123, 0.3);
}

.rank-btn-primary:hover {
    background: #c73869;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(224, 69, 123, 0.4);
}

.rank-btn-secondary {
    background: #6c757d;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.rank-btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ===== MOBILE RESPONSIVENESS ===== */

@media (max-width: 768px) {
    .rank-modal {
        padding: 10px;
    }
    
    .rank-modal-content {
        max-width: 100%;
        max-height: 90vh;
    }
    
    .rank-modal-header {
        padding: 16px;
    }
    
    .rank-modal-title {
        font-size: 20px;
    }
    
    .rank-modal-body {
        padding: 16px;
    }
    
    .filter-row {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .filter-toggle {
        gap: 8px;
    }
    
    .toggle-label {
        font-size: 13px;
    }
    
    .toggle-switch {
        width: 50px;
        height: 25px;
    }
    
    .toggle-slider:before {
        height: 17px;
        width: 17px;
        left: 4px;
        bottom: 4px;
    }
    
    .toggle-switch input:checked + .toggle-slider:before {
        transform: translateX(25px);
    }
    
    .rank-table th,
    .rank-table td {
        padding: 8px;
        font-size: 13px;
    }
    
    .rank-pagination {
        gap: 4px;
    }
    
    .rank-page-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
        padding: 0 8px;
    }
    
    .rank-modal-actions {
        flex-direction: column;
    }
    
    .rank-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .rank-modal-header {
        padding: 12px;
    }
    
    .rank-modal-title {
        font-size: 18px;
    }
    
    .rank-modal-body {
        padding: 12px;
    }
    
    .toggle-switch {
        width: 45px;
        height: 22px;
    }
    
    .toggle-slider:before {
        height: 14px;
        width: 14px;
        left: 4px;
        bottom: 4px;
    }
    
    .toggle-switch input:checked + .toggle-slider:before {
        transform: translateX(23px);
    }
    
    .rank-table th,
    .rank-table td {
        padding: 6px;
        font-size: 12px;
    }
    
    .rank-page-btn {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

/* ===== LOADING STATES ===== */

.rank-modal-body:empty::after {
    content: "Loading...";
    display: block;
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 40px;
}

/* ===== ACCESSIBILITY ===== */

.rank-modal-close:focus,
.rank-page-btn:focus,
.rank-btn:focus,
.sales-amount:focus,
.rank-info-btn:focus,
.toggle-switch input:focus + .toggle-slider {
    outline: 2px solid #E0457B;
    outline-offset: 2px;
}

/* ===== PRINT STYLES ===== */

@media print {
    .rank-modal {
        position: static;
        background: none;
        display: block;
    }
    
    .rank-modal-content {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .rank-modal-header {
        background: none;
        color: #000;
    }
    
    .rank-modal-close {
        display: none;
    }
}