/**
 * RiskAss Module Access Control - Microsoft 365 Style
 */

.riskass-mac-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
    padding: 40px 20px;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 20px;
}

.mac-access-denied {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    padding: 48px;
    max-width: 520px;
    width: 100%;
    text-align: center;
    border: none;
    position: relative;
    overflow: hidden;
}

.mac-access-denied::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0078d4 0%, #40e0d0 100%);
}

.mac-icon-container {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
    position: relative;
}

.mac-lock-icon {
    width: 80px;
    height: 80px;
    color: #0078d4;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 50%;
    position: relative;
    animation: pulse 2s ease-in-out infinite;
}

.mac-lock-icon svg {
    fill: none;
    stroke: white;
    stroke-width: 2;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

.mac-title {
    font-size: 24px;
    font-weight: 600;
    color: #323130;
    margin: 0 0 16px 0;
    line-height: 1.3;
}

.mac-module-badge {
    display: inline-block;
    background: #0078d4;
    color: white;
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
}

.mac-message {
    font-size: 16px;
    color: #605e5c;
    line-height: 1.5;
    margin: 0 0 12px 0;
}

.mac-message strong {
    color: #323130;
    font-weight: 600;
}

.mac-submessage {
    font-size: 14px;
    color: #8a8886;
    line-height: 1.5;
    margin: 0 0 32px 0;
}

.mac-admin-info {
    border-top: 1px solid #edebe9;
    padding-top: 32px;
    margin-top: 32px;
}

.mac-admin-label {
    font-size: 14px;
    color: #605e5c;
    margin: 0 0 16px 0;
}

.mac-admin-card {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #f0f4f8 100%);
    border: 1px solid #e1e5ea;
    border-radius: 12px;
    padding: 20px;
    text-align: left;
    transition: all 0.3s ease;
    cursor: pointer;
}

.mac-admin-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.mac-admin-icon {
    width: 48px;
    height: 48px;
    color: #0078d4;
    background: white;
    padding: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 16px;
    box-shadow: 0 2px 10px rgba(0, 120, 212, 0.2);
}

.mac-admin-details {
    flex: 1;
}

.mac-admin-name {
    font-size: 16px;
    font-weight: 600;
    color: #323130;
    margin: 0 0 4px 0;
}

.mac-admin-email {
    font-size: 14px;
    color: #0078d4;
    text-decoration: none;
    transition: color 0.2s ease;
}

.mac-admin-email:hover {
    color: #106ebe;
    text-decoration: underline;
}

.mac-module-emoji {
    position: absolute;
    bottom: -10px;
    right: -10px;
    font-size: 32px;
    background: white;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Dark mode support - Only when explicitly set by theme */
body[data-theme="dark"] .riskass-mac-container,
html[data-theme="dark"] .riskass-mac-container,
.theme-dark .riskass-mac-container {
    background: linear-gradient(135deg, #1a1f3a 0%, #2d3561 100%);
}

body[data-theme="dark"] .mac-access-denied,
html[data-theme="dark"] .mac-access-denied,
.theme-dark .mac-access-denied {
    background: #2b2f45;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

body[data-theme="dark"] .mac-access-denied::before,
html[data-theme="dark"] .mac-access-denied::before,
.theme-dark .mac-access-denied::before {
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
}

body[data-theme="dark"] .mac-lock-icon,
html[data-theme="dark"] .mac-lock-icon,
.theme-dark .mac-lock-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body[data-theme="dark"] .mac-title,
html[data-theme="dark"] .mac-title,
.theme-dark .mac-title {
    color: #ffffff;
}

body[data-theme="dark"] .mac-module-badge,
html[data-theme="dark"] .mac-module-badge,
.theme-dark .mac-module-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

body[data-theme="dark"] .mac-message,
html[data-theme="dark"] .mac-message,
.theme-dark .mac-message {
    color: #e0e0e0;
}

body[data-theme="dark"] .mac-message strong,
html[data-theme="dark"] .mac-message strong,
.theme-dark .mac-message strong {
    color: #ffffff;
}

body[data-theme="dark"] .mac-submessage,
html[data-theme="dark"] .mac-submessage,
.theme-dark .mac-submessage {
    color: #b0b0b0;
}

body[data-theme="dark"] .mac-admin-info,
html[data-theme="dark"] .mac-admin-info,
.theme-dark .mac-admin-info {
    border-top-color: #3a3f5c;
}

body[data-theme="dark"] .mac-admin-label,
html[data-theme="dark"] .mac-admin-label,
.theme-dark .mac-admin-label {
    color: #d0d0d0;
}

body[data-theme="dark"] .mac-admin-card,
html[data-theme="dark"] .mac-admin-card,
.theme-dark .mac-admin-card {
    background: linear-gradient(135deg, #3a3f5c 0%, #434966 100%);
    border-color: #4a5073;
}

body[data-theme="dark"] .mac-admin-card:hover,
html[data-theme="dark"] .mac-admin-card:hover,
.theme-dark .mac-admin-card:hover {
    box-shadow: 0 8px 20px rgba(79, 172, 254, 0.2);
}

body[data-theme="dark"] .mac-admin-icon,
html[data-theme="dark"] .mac-admin-icon,
.theme-dark .mac-admin-icon {
    background: #2b2f45;
    color: #4facfe;
    box-shadow: 0 2px 10px rgba(79, 172, 254, 0.3);
}

body[data-theme="dark"] .mac-admin-name,
html[data-theme="dark"] .mac-admin-name,
.theme-dark .mac-admin-name {
    color: #ffffff;
}

body[data-theme="dark"] .mac-admin-email,
html[data-theme="dark"] .mac-admin-email,
.theme-dark .mac-admin-email {
    color: #4facfe;
}

body[data-theme="dark"] .mac-admin-email:hover,
html[data-theme="dark"] .mac-admin-email:hover,
.theme-dark .mac-admin-email:hover {
    color: #00f2fe;
}

body[data-theme="dark"] .mac-module-emoji,
html[data-theme="dark"] .mac-module-emoji,
.theme-dark .mac-module-emoji {
    background: #3a3f5c;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Responsive design */
@media (max-width: 600px) {
    .riskass-mac-container {
        padding: 20px 16px;
    }
    
    .mac-access-denied {
        padding: 32px 24px;
    }
    
    .mac-title {
        font-size: 20px;
    }
    
    .mac-message {
        font-size: 14px;
    }
    
    .mac-admin-card {
        flex-direction: column;
        text-align: center;
    }
    
    .mac-admin-icon {
        margin-right: 0;
        margin-bottom: 12px;
    }
}

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

.mac-access-denied {
    animation: fadeIn 0.3s ease-out;
}

/* Additional Microsoft 365 styling */
.mac-access-denied:focus-visible {
    outline: 2px solid #0078d4;
    outline-offset: 2px;
}

/* Loading state (if needed in future) */
.mac-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f2f1;
    border-top-color: #0078d4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Credits Log Styles */
.riskass-credits-log-container {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1dfdd;
    overflow: hidden;
    margin: 20px 0;
}

.credits-log-header {
    background: linear-gradient(135deg, #0078d4 0%, #106ebe 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.credits-log-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.credits-log-icon {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
}

.credits-log-actions .btn-export {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.credits-log-actions .btn-export:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.credits-log-actions .btn-export svg {
    width: 16px;
    height: 16px;
}

.credits-log-filters {
    background: #f8f9fa;
    border-bottom: 1px solid #e1dfdd;
    padding: 20px 24px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: end;
}

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

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: #323130;
    margin-bottom: 4px;
}

.filter-date,
.filter-select,
.filter-input {
    padding: 8px 12px;
    border: 1px solid #d2d0ce;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s ease;
}

.filter-date:focus,
.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

.btn-filter {
    background: #0078d4;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease;
    height: 36px;
}

.btn-filter:hover {
    background: #106ebe;
}

.btn-filter svg {
    width: 16px;
    height: 16px;
}

.credits-log-content {
    padding: 24px;
}

.credits-log-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: #605e5c;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f2f1;
    border-top-color: #0078d4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner-inline {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

.credits-log-table-container {
    overflow-x: auto;
    border: 1px solid #e1dfdd;
    border-radius: 6px;
}

.credits-log-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.credits-log-table th {
    background: #f8f9fa;
    color: #323130;
    font-weight: 600;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 2px solid #e1dfdd;
    font-size: 13px;
    white-space: nowrap;
}

.credits-log-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f2f1;
    font-size: 14px;
    color: #323130;
}

.credits-log-table tr:hover {
    background: #f8f9fa;
}

.credits-log-table tr:last-child td {
    border-bottom: none;
}

.credits-log-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 16px 0;
    border-top: 1px solid #f3f2f1;
}

.btn-page {
    background: white;
    border: 1px solid #d2d0ce;
    color: #323130;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-page:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #8a8886;
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-page svg {
    width: 16px;
    height: 16px;
}

.page-info {
    font-size: 14px;
    color: #605e5c;
}

.page-info .current-page,
.page-info .total-pages {
    font-weight: 600;
    color: #323130;
}

.riskass-credits-log-error {
    background: #fdf2f2;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 16px 20px;
    border-radius: 6px;
    font-size: 14px;
    margin: 20px 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .credits-log-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .credits-log-table-container {
        font-size: 12px;
    }
    
    .credits-log-table th,
    .credits-log-table td {
        padding: 8px 12px;
    }
    
    .credits-log-pagination {
        flex-direction: column;
        gap: 16px;
    }
}

/* Dark theme support */
body[data-theme="dark"] .riskass-credits-log-container,
html[data-theme="dark"] .riskass-credits-log-container {
    background: #2b2f45;
    border-color: #3a3f5c;
}

body[data-theme="dark"] .credits-log-filters,
html[data-theme="dark"] .credits-log-filters {
    background: #3a3f5c;
    border-color: #4a5073;
}

body[data-theme="dark"] .filter-date,
body[data-theme="dark"] .filter-select,
body[data-theme="dark"] .filter-input,
html[data-theme="dark"] .filter-date,
html[data-theme="dark"] .filter-select,
html[data-theme="dark"] .filter-input {
    background: #2b2f45;
    border-color: #4a5073;
    color: #f3f2f1;
}

body[data-theme="dark"] .credits-log-table,
html[data-theme="dark"] .credits-log-table {
    background: #2b2f45;
}

body[data-theme="dark"] .credits-log-table th,
html[data-theme="dark"] .credits-log-table th {
    background: #3a3f5c;
    color: #f3f2f1;
    border-color: #4a5073;
}

body[data-theme="dark"] .credits-log-table td,
html[data-theme="dark"] .credits-log-table td {
    color: #e0e0e0;
    border-color: #3a3f5c;
}

body[data-theme="dark"] .credits-log-table tr:hover,
html[data-theme="dark"] .credits-log-table tr:hover {
    background: #3a3f5c;
}

body[data-theme="dark"] .btn-page,
html[data-theme="dark"] .btn-page {
    background: #3a3f5c;
    border-color: #4a5073;
    color: #f3f2f1;
}

body[data-theme="dark"] .btn-page:hover:not(:disabled),
html[data-theme="dark"] .btn-page:hover:not(:disabled) {
    background: #434966;
}