/**
 * Brain Assessment Suite - Admin Styles
 * Professional dashboard styling
 */

/* ========================================
   Statistics Cards
   ======================================== */
.bas-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.bas-stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.bas-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bas-stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.bas-stat-card.bas-stat-primary .bas-stat-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.bas-stat-card.bas-stat-success .bas-stat-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
}

.bas-stat-card.bas-stat-info .bas-stat-icon {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #fff;
}

.bas-stat-card.bas-stat-warning .bas-stat-icon {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: #fff;
}

.bas-stat-content h3 {
    margin: 0 0 5px 0;
    font-size: 32px;
    font-weight: bold;
    color: #2c3e50;
}

.bas-stat-content p {
    margin: 0;
    font-size: 14px;
    color: #7f8c8d;
}

/* ========================================
   Charts
   ======================================== */
.bas-charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.bas-chart-box {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bas-chart-box.bas-chart-full {
    grid-column: 1 / -1;
}

.bas-chart-box h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
}

.bas-chart-box canvas {
    max-height: 300px;
}

/* ========================================
   Tables
   ======================================== */
.bas-section {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bas-section h2 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
}

.bas-results-table,
.bas-candidates-table {
    margin-top: 20px;
}

.bas-results-table td,
.bas-candidates-table td {
    vertical-align: middle;
}

/* Score Bar */
.bas-score-bar {
    position: relative;
    width: 120px;
    height: 24px;
    background: #ecf0f1;
    border-radius: 12px;
    overflow: hidden;
}

.bas-score-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
    transition: width 0.3s;
}

.bas-score-bar .bas-score-fill[style*="width: 0"] {
    background: #e74c3c;
}

.bas-score-bar .bas-score-fill[style*="width: 1"],
.bas-score-bar .bas-score-fill[style*="width: 2"],
.bas-score-bar .bas-score-fill[style*="width: 3"],
.bas-score-bar .bas-score-fill[style*="width: 4"],
.bas-score-bar .bas-score-fill[style*="width: 5"] {
    background: linear-gradient(90deg, #fc4a1a 0%, #f7b733 100%);
}

.bas-score-text {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 12px;
    font-weight: bold;
    color: #2c3e50;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Status Badges */
.bas-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.bas-status.bas-status-success {
    background: #d4edda;
    color: #155724;
}

.bas-status.bas-status-error {
    background: #f8d7da;
    color: #721c24;
}

.bas-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 5px;
}

.bas-badge-gray {
    background: #6c757d;
    color: #fff;
}

/* ========================================
   Filters & Search
   ======================================== */
.bas-filters-panel {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bas-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.bas-filter-item label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 13px;
    color: #2c3e50;
}

.bas-filter-item input,
.bas-filter-item select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.bas-filter-actions {
    display: flex;
    gap: 10px;
}

.bas-search-panel {
    margin: 20px 0;
}

#bas-candidate-search {
    width: 100%;
    max-width: 400px;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.bas-results-summary {
    margin: 15px 0;
    color: #666;
}

/* ========================================
   Bulk Actions
   ======================================== */
.bas-bulk-actions {
    margin: 20px 0;
    display: flex;
    gap: 10px;
    align-items: center;
}

#bas-bulk-action {
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* ========================================
   Actions Column
   ======================================== */
.bas-actions {
    white-space: nowrap;
}

.bas-actions .button {
    margin-right: 5px;
}

.bas-actions .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ========================================
   Candidate Details
   ======================================== */
.bas-candidate-header {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    margin: 30px 0;
    display: flex;
    gap: 30px;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bas-candidate-avatar img {
    border-radius: 50%;
    border: 4px solid #ecf0f1;
}

.bas-candidate-info h2 {
    margin: 0 0 15px 0;
    font-size: 28px;
    color: #2c3e50;
}

.bas-candidate-info p {
    margin: 8px 0;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bas-candidate-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bas-candidate-cell img {
    border-radius: 50%;
}

/* ========================================
   Modal
   ======================================== */
.bas-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
}

.bas-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.bas-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.bas-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.bas-modal-close:hover {
    color: #333;
}

/* ========================================
   Empty State
   ======================================== */
.bas-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.bas-empty-state .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    opacity: 0.3;
    margin-bottom: 20px;
}

.bas-empty-state p {
    font-size: 16px;
    margin: 10px 0 20px 0;
}

/* ========================================
   Loading State
   ======================================== */
.bas-loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.bas-loading:after {
    content: "...";
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

/* ========================================
   View All Link
   ======================================== */
.bas-view-all {
    text-align: center;
    margin-top: 20px;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 782px) {
    .bas-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .bas-charts-row {
        grid-template-columns: 1fr;
    }
    
    .bas-filters-grid {
        grid-template-columns: 1fr;
    }
    
    .bas-candidate-header {
        flex-direction: column;
        text-align: center;
    }
    
    .bas-modal-content {
        width: 95%;
        padding: 20px;
    }
}

@media (max-width: 600px) {
    .bas-score-bar {
        width: 80px;
    }
    
    .bas-actions .button {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .bas-stat-content h3 {
        font-size: 24px;
    }
}

/* ========================================
   Settings Page
   ======================================== */
.bas-settings-form {
    max-width: 1200px;
}

.bas-settings-tabs {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    border-bottom: 2px solid #ddd;
    flex-wrap: wrap;
}

.bas-tab-button {
    background: #f0f0f1;
    border: 1px solid #ddd;
    border-bottom: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 6px 6px 0 0;
    transition: all 0.3s;
}

.bas-tab-button:hover {
    background: #e8e8e9;
}

.bas-tab-button.active {
    background: #fff;
    color: #2271b1;
    border-bottom: 2px solid #fff;
    margin-bottom: -2px;
}

.bas-tab-button .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.bas-tab-content {
    display: none;
    padding: 30px 0;
}

.bas-tab-content.active {
    display: block;
}

.bas-settings-section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
}

.bas-settings-section h2 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
}

.bas-settings-section h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.bas-settings-section .form-table {
    margin-top: 20px;
}

.bas-settings-section .form-table th {
    width: 250px;
    padding: 15px 10px 15px 0;
}

.bas-settings-section .form-table td {
    padding: 15px 10px;
}

.bas-test-toggles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.bas-toggle-card {
    background: #f8f9fa;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: block;
}

.bas-toggle-card:hover {
    border-color: #2271b1;
    background: #f0f6fc;
}

.bas-toggle-card input[type="checkbox"] {
    float: right;
    margin: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.bas-toggle-card input[type="checkbox"]:checked + .bas-toggle-content {
    color: #2271b1;
}

.bas-toggle-content {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 30px;
}

.bas-toggle-icon {
    font-size: 32px;
    line-height: 1;
}

.bas-settings-footer {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    position: sticky;
    bottom: 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.bas-settings-footer .button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    height: auto;
}

.bas-settings-footer .button .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Logo Preview */
.bas-logo-preview {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: inline-block;
}

.bas-logo-preview img {
    display: block;
}

/* Description Text */
.bas-settings-section p.description {
    margin: 8px 0 0 0;
    color: #666;
    font-style: italic;
}

/* Code Tags */
.bas-settings-section code {
    background: #f0f0f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    color: #d63638;
    font-family: 'Courier New', monospace;
}

/* WordPress Editor */
.bas-settings-section .wp-editor-wrap {
    margin-top: 10px;
}

/* Input Fields */
.bas-settings-section input[type="text"],
.bas-settings-section input[type="email"],
.bas-settings-section input[type="url"],
.bas-settings-section input[type="number"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.bas-settings-section input[type="text"]:focus,
.bas-settings-section input[type="email"]:focus,
.bas-settings-section input[type="url"]:focus,
.bas-settings-section input[type="number"]:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Checkboxes */
.bas-settings-section input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
}

.bas-settings-section label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 782px) {
    .bas-settings-tabs {
        flex-direction: column;
    }
    
    .bas-tab-button {
        width: 100%;
        justify-content: flex-start;
    }
    
    .bas-test-toggles {
        grid-template-columns: 1fr;
    }
    
    .bas-settings-section .form-table th {
        width: 100%;
        display: block;
        padding-bottom: 5px;
    }
    
    .bas-settings-section .form-table td {
        display: block;
        padding-top: 5px;
    }
    
    .bas-settings-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .bas-settings-footer .button {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .bas-settings-section {
        padding: 15px;
    }
    
    .bas-tab-button {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .bas-toggle-content {
        font-size: 14px;
    }
    
    .bas-toggle-icon {
        font-size: 24px;
    }
}

/* Spin animation for loading states */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.dashicons.spin {
    animation: spin 1s linear infinite;
}

/* Button loading state */
.button .dashicons.spin {
    display: inline-block;
}
