/**
 * Permissions CSS
 * 
 * Styles for role-based access control UI elements
 */

/* Read-only badges */
.read-only-badge {
    font-size: 0.6em !important;
    vertical-align: middle;
    margin-left: 0.25rem;
}

/* Access denied styling */
.access-denied {
    text-align: center;
    padding: 2rem;
}

.access-denied i {
    font-size: 3rem;
    color: #dc3545;
    margin-bottom: 1rem;
}

/* Permission indicators */
.permission-indicator {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.permission-indicator.read-only {
    background-color: #ffc107;
    color: #212529;
}

.permission-indicator.full-access {
    background-color: #28a745;
    color: white;
}

.permission-indicator.no-access {
    background-color: #dc3545;
    color: white;
}

/* Disabled elements styling */
.disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* Hidden elements for permissions */
[data-permission-hidden="true"] {
    display: none !important;
}

/* Permission tooltips */
.permission-tooltip {
    position: relative;
    cursor: help;
}

.permission-tooltip::after {
    content: attr(data-permission-message);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}

.permission-tooltip:hover::after {
    opacity: 1;
}

/* Role-specific styling */
.role-admin {
    border-left: 4px solid #dc3545;
}

.role-manager {
    border-left: 4px solid #ffc107;
}

.role-cashier {
    border-left: 4px solid #17a2b8;
}

/* Navigation permission styling */
.nav-link[data-permission="denied"] {
    opacity: 0.5;
    pointer-events: none;
}

.nav-link[data-permission="read-only"]::after {
    content: "👁";
    margin-left: 0.5rem;
    font-size: 0.8em;
}

/* Form permission styling */
.form-read-only input,
.form-read-only select,
.form-read-only textarea {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    cursor: not-allowed;
}

.form-read-only .btn-primary,
.form-read-only .btn-success {
    display: none;
}

/* Table permission styling */
.table-read-only .actions-cell,
.table-read-only .checkbox-cell {
    display: none;
}

.table-read-only th:last-child,
.table-read-only td:last-child {
    display: none;
}

/* Permission alert styling */
.permission-alert {
    border-left: 4px solid #17a2b8;
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

.permission-alert .alert-icon {
    color: #17a2b8;
    margin-right: 0.5rem;
}

/* Button permission states */
.btn[data-permission="denied"] {
    display: none;
}

.btn[data-permission="disabled"] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Card permission styling */
.card-read-only {
    background-color: #f8f9fa;
}

.card-read-only .card-header {
    background-color: #e9ecef;
    border-bottom-color: #dee2e6;
}

/* Loading states for permission checks */
.permission-loading {
    opacity: 0.7;
    pointer-events: none;
}

.permission-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: permission-spin 1s linear infinite;
}

@keyframes permission-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive permission indicators */
@media (max-width: 768px) {
    .read-only-badge {
        display: block;
        margin-top: 0.25rem;
        margin-left: 0;
    }
    
    .permission-tooltip::after {
        position: fixed;
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        transform: none;
        white-space: normal;
        text-align: center;
    }
}

/* Print styles - hide permission indicators */
@media print {
    .read-only-badge,
    .permission-indicator,
    .permission-alert {
        display: none !important;
    }
}