/* =========================================================
   POLIKA PLATFORM - Staff & Role-Based Access Control Styles
   File: assets/css/admin-roles.css
   ========================================================= */

/* --- Sub-Tab Navigation Header --- */
.roles-sub-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.75rem;
}

.roles-sub-tab-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary, #aaa);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.roles-sub-tab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.roles-sub-tab-btn.active {
    background: rgba(154, 179, 245, 0.12);
    color: var(--accent-color, #9AB3F5);
    border-color: rgba(154, 179, 245, 0.35);
    box-shadow: 0 0 15px rgba(154, 179, 245, 0.1);
}

.roles-sub-view {
    display: none;
    animation: fadeIn 0.25s ease-in-out;
}

.roles-sub-view.active {
    display: block;
}

/* --- Role Badges --- */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.role-badge-admin {
    background: rgba(154, 179, 245, 0.15);
    color: #9AB3F5;
    border: 1px solid rgba(154, 179, 245, 0.3);
}

.role-badge-manager {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.role-badge-cashier {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.role-badge-production {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.role-badge-finance {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.role-badge-custom {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* --- Role Cards Grid --- */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.role-card {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.role-card:hover {
    border-color: rgba(154, 179, 245, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

.role-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.role-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary, #aaa);
    line-height: 1.4;
    margin-bottom: 1rem;
    min-height: 38px;
}

.role-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #888;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 0.5rem;
}

.role-card-actions {
    display: flex;
    gap: 8px;
}

/* --- Permissions Matrix Grid --- */
.permissions-matrix-container {
    background: #181818;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.matrix-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1.2rem;
    margin-bottom: 1.25rem;
}

.matrix-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.matrix-group-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent-color, #9AB3F5);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.matrix-group-actions button {
    background: transparent;
    border: none;
    color: #888;
    font-size: 0.78rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s;
}

.matrix-group-actions button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.matrix-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.perm-checkbox-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.perm-checkbox-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
}

.perm-checkbox-card.checked {
    background: rgba(154, 179, 245, 0.08);
    border-color: rgba(154, 179, 245, 0.25);
}

.perm-checkbox-card input[type="checkbox"] {
    accent-color: var(--accent-color, #9AB3F5);
    width: 17px;
    height: 17px;
    cursor: pointer;
}

.perm-label-wrap {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.perm-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.perm-code {
    font-size: 0.72rem;
    color: #777;
    font-family: monospace;
}

/* --- Staff Table Styling --- */
.staff-user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.staff-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(154, 179, 245, 0.2), rgba(168, 85, 247, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.staff-user-info {
    display: flex;
    flex-direction: column;
}

.staff-name {
    font-weight: 500;
    color: #fff;
    font-size: 0.9rem;
}

.staff-email {
    font-size: 0.78rem;
    color: var(--text-secondary, #aaa);
}

.staff-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.staff-status-active {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.staff-status-inactive {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* --- User Profile Widget in Sidebar --- */
.sidebar-user-widget {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 12px;
    margin: 10px 0 14px 0;
    display: flex;
    align-items: center;
    gap: 11px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.sidebar-user-widget:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%);
    border-color: rgba(255, 255, 255, 0.14);
}

.user-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.user-avatar-initials {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(154, 179, 245, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.user-online-pulse {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 9px;
    height: 9px;
    background: #22c55e;
    border: 2px solid #1a1a1a;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.sidebar-user-widget .user-details {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.sidebar-user-widget .user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #f3f4f6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.2px;
    line-height: 1.25;
}

.sidebar-user-widget .user-role-line {
    display: flex;
    align-items: center;
}

.sidebar-role-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.58rem;
    font-weight: 500;
    letter-spacing: 0.35px;
    text-transform: uppercase;
    padding: 1.5px 5.5px;
    border-radius: 4px;
    line-height: 1.2;
    width: fit-content;
}

.sidebar-role-pill i {
    font-size: 0.52rem;
}

.sidebar-role-admin {
    background: rgba(154, 179, 245, 0.1);
    color: #9AB3F5;
    border: 1px solid rgba(154, 179, 245, 0.25);
}

.sidebar-role-manager {
    background: rgba(168, 85, 247, 0.1);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.25);
}

.sidebar-role-cashier {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.sidebar-role-production {
    background: rgba(249, 115, 22, 0.1);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.25);
}

.sidebar-role-finance {
    background: rgba(234, 179, 8, 0.1);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.25);
}

.sidebar-role-custom {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

/* --- Access Denied Screen --- */
#access-denied-section {
    display: none;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1e1313 0%, #000 100%);
    padding: 20px;
}

.access-denied-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 59, 48, 0.2);
    border-radius: 16px;
    padding: 3rem 2.5rem;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
}

.access-denied-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 59, 48, 0.15);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: #ff3b30;
    font-size: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.access-denied-card h2 {
    color: #fff;
    margin: 0 0 0.75rem 0;
    font-size: 1.6rem;
}

.access-denied-card p {
    color: var(--text-secondary, #aaa);
    font-size: 0.92rem;
    line-height: 1.5;
    margin-bottom: 2rem;
}

.access-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #241414;
    border: 1px solid rgba(255, 59, 48, 0.4);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    font-size: 0.88rem;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Fullscreen Modal Styles for Staff & Roles --- */
.staff-fullscreen-modal {
    padding: 16px !important;
}

.staff-fullscreen-dialog {
    width: 96vw !important;
    max-width: 1300px !important;
    height: 92vh !important;
    max-height: 94vh !important;
    background: #18181b !important;
    border-radius: 16px !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.95), 0 0 40px rgba(154, 179, 245, 0.05) !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 1.5rem 2rem !important;
    overflow: hidden !important;
    transition: all 0.25s ease-in-out;
}

.staff-fullscreen-dialog.fullscreen-edge {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    padding: 1.5rem 2.5rem !important;
}

.staff-modal-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 2rem;
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 8px;
    align-items: start;
}

@media (max-width: 900px) {
    .staff-fullscreen-modal {
        padding: 0 !important;
    }
    .staff-fullscreen-dialog {
        width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        padding: 1.25rem !important;
    }
    .staff-modal-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Role Scope & Permissions Live Preview Box */
.role-preview-card {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.role-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.role-preview-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-preview-desc {
    font-size: 0.84rem;
    color: #aaa;
    line-height: 1.4;
    margin: 0;
}

.role-preview-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.role-preview-tag {
    background: rgba(154, 179, 245, 0.08);
    color: #9AB3F5;
    border: 1px solid rgba(154, 179, 245, 0.2);
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
