/* User Login Tracker Admin Styles */

.ultk_last_login_time {
    cursor: help;
    display: block;
    margin-bottom: 5px;
}

.ultk_active_user {
    color: #46b450;
    font-weight: bold;
}

.ultk_inactive_user {
    color: #dc3232;
}

.ultk_moderate_user {
    color: #ffb900;
}

/* Dashboard Widget Styles */
.ultk-dashboard-widget {
    font-size: 13px;
}

.ultk-dashboard-widget .inside {
    margin: 0;
    padding: 12px;
}

.ultk-dashboard-widget .ultk-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.ultk-dashboard-widget .ultk-stat-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    border-left: 4px solid #0073aa;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.ultk-dashboard-widget .ultk-stat-box:hover {
    transform: translateY(-1px);
}

.ultk-dashboard-widget .ultk-stat-number {
    font-size: 18px;
    font-weight: bold;
    color: #0073aa;
    display: block;
    margin-bottom: 4px;
}

.ultk-dashboard-widget .ultk-stat-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.ultk-dashboard-widget h4 {
    margin: 20px 0 10px 0;
    font-size: 14px;
    color: #23282d;
    border-bottom: 1px solid #e1e1e1;
    padding-bottom: 8px;
}

/* Recent Logins List Styling for Dashboard */
.ultk-dashboard-widget .ultk-recent-logins {
    max-height: 200px;
    overflow-y: auto;
}

.ultk-dashboard-widget .ultk-login-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f1f1;
    transition: background-color 0.2s ease;
}

.ultk-dashboard-widget .ultk-login-item:last-child {
    border-bottom: none;
}

.ultk-dashboard-widget .ultk-login-item:hover {
    background-color: #f8f9fa;
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
    border-radius: 4px;
}

.ultk-dashboard-widget .ultk-user-info {
    font-weight: 500;
    color: #23282d;
    flex: 1;
}

.ultk-dashboard-widget .ultk-login-time {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
    margin-left: 10px;
}

.ultk-dashboard-widget .button {
    margin-top: 15px;
    width: 100%;
    text-align: center;
    justify-content: center;
}

.ultk-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.ultk-stat-box {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
    border-left: 4px solid #0073aa;
}

.ultk-stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
    display: block;
}

.ultk-stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* Recent Logins */
.ultk-recent-logins {
    max-height: 200px;
    overflow-y: auto;
}

.ultk-login-item {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ultk-login-item:last-child {
    border-bottom: none;
}

.ultk-user-info {
    font-weight: 500;
}

.ultk-login-time {
    color: #666;
    font-size: 12px;
}

/* View History Link */
.ultk-view-history {
    color: #0073aa;
    text-decoration: none;
    font-size: 12px;
}

.ultk-view-history:hover {
    text-decoration: underline;
}

/* Modal Styles */
.ultk-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.ultk-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border-radius: 5px;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.ultk-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.ultk-modal-close:hover {
    color: #000;
}

/* History Table */
.ultk-history-summary {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    border-left: 4px solid #0073aa;
}

.ultk-history-summary p {
    margin: 5px 0;
}

.ultk-history-summary strong {
    color: #0073aa;
    font-size: 16px;
}

.ultk-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.ultk-history-table th,
.ultk-history-table td {
    padding: 8px 12px;
    border: 1px solid #ddd;
    text-align: left;
}

.ultk-history-table th {
    background-color: #f9f9f9;
    font-weight: bold;
}

.ultk-history-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* Charts Container */
.ultk-charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-container {
    background: #fff;
    padding: 20px;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
}

.chart-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #23282d;
}

/* Full Width Recent Logins Card */
.ultk-recent-logins-card {
    max-width: none !important;
    width: 100% !important;
}

.ultk-recent-logins-card .inside {
    overflow-x: auto;
}

/* Recent Logins Table with Load More */
.ultk-recent-logins-wrapper {
    margin-top: 20px;
}

.ultk-pagination-info {
    background: #f8f9fa;
    padding: 10px 15px;
    border: 1px solid #e1e5e9;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    font-size: 13px;
    color: #666;
    text-align: center;
}

.ultk-recent-table {
    border-radius: 0 0 4px 4px;
    margin-bottom: 0;
    width: 100%;
    table-layout: auto;
}

.ultk-recent-table th,
.ultk-recent-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ultk-recent-table th:first-child,
.ultk-recent-table td:first-child {
    width: 20%;
    min-width: 120px;
}

.ultk-recent-table th:nth-child(2),
.ultk-recent-table td:nth-child(2) {
    width: 25%;
    min-width: 150px;
}

.ultk-recent-table th:nth-child(3),
.ultk-recent-table td:nth-child(3) {
    width: 15%;
    min-width: 100px;
}

.ultk-recent-table th:nth-child(4),
.ultk-recent-table td:nth-child(4) {
    width: 40%;
    min-width: 200px;
    white-space: normal;
    word-break: break-word;
}

.ultk-recent-table td code {
    background: #f1f1f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    color: #333;
}

.ultk-load-more-wrapper {
    text-align: center;
    margin-top: 15px;
    padding: 15px;
    background: #fafafa;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
}

.ultk-load-more {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
}

.ultk-load-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ultk-loading {
    color: #666;
    font-style: italic;
}

.ultk-loading .spinner {
    float: none;
    margin: 0 5px 0 0;
    vertical-align: middle;
}

/* Responsive Design for Recent Logins */
@media screen and (max-width: 1200px) {
    .ultk-recent-table th:nth-child(4),
    .ultk-recent-table td:nth-child(4) {
        max-width: 250px;
    }
}

@media screen and (max-width: 900px) {
    .ultk-recent-table {
        font-size: 12px;
    }
    
    .ultk-recent-table th:nth-child(4),
    .ultk-recent-table td:nth-child(4) {
        max-width: 200px;
    }
}

@media screen and (max-width: 768px) {
    .ultk-recent-logins-card .inside {
        padding: 10px;
    }
    
    .ultk-recent-table {
        font-size: 11px;
    }
    
    .ultk-recent-table th,
    .ultk-recent-table td {
        padding: 6px;
    }
}

.chart-container canvas {
    max-width: 100%;
    height: auto;
}

.chart-error {
    text-align: center;
    color: #d63638;
    padding: 40px 20px;
    background: #fafafa;
    border: 1px dashed #ddd;
    border-radius: 4px;
    font-style: italic;
}

@media (max-width: 768px) {
    .ultk-charts-container {
        grid-template-columns: 1fr;
    }
    
    .ultk-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

/* Settings Page */
.ultk-settings-section {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    margin-bottom: 20px;
    padding: 20px;
}

.ultk-settings-section h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* Export Button */
.ultk-export-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.ultk-export-btn:hover {
    background: #005a87;
    color: white;
}

/* Loading States */
.ultk-loading {
    opacity: 0.6;
    pointer-events: none;
}

.ultk-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: ultk-spin 1s linear infinite;
}

@keyframes ultk-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .ultk-modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 15px;
    }
    
    .ultk-stat-box {
        padding: 10px;
    }
    
    .ultk-stat-number {
        font-size: 18px;
    }
}
